GIT-FORCE-CLONE(1)
π GIT-FORCE-CLONE(1) β the Git Extras one, bestie π
okay so bestie, sit down, hydrate, because this command is that girl and she does NOT play around.
β¨ NAME β¨
git-force-clone β overwrite local repositories with clone π¦
πΈ SYNOPSIS πΈ
git-force-clone --help git-force-clone {remote_url} {destination_path}
git-force-clone --branch {branch_name} {remote_url} {destination_path}
π DESCRIPTION π
So basically it gives you the basic functionality of git clone, but β and this is the plot twist β if the destination git repository already exists, it will force-reset it so it looks like a clone of the remote. Like, glow-up via demolition. π
And the reason it's iconic? Because it doesn't actually delete the directory, it's usually significantly faster than the alternative of deleting the directory and cloning the repository from scratch. no cap. β¨
β οΈ CAUTION: If the repository exists, this will destroy all local work: changed files will be reset, local branches and other remotes will be removed. π Like, gone gone. Not "in the trash" gone, gone gone. Respect the caution or she will humble you. π
π§ PROCESS π§
Here's the tea, step by step.
If target-directory doesn't exist or isn't a git repository, then the arguments will simply be passed through to git clone. easy peasy, nothing spicy. π
If target-directory exists and is a git repository, then this will:
- Remove all remotes π«Ά
- Set the
originremote to{remote_url}and fetch the remote π - Discover the default branch, if no branch was specified π
- Check out the selected branch π
- Delete all other local branches π
periodt. that's the whole ritual.
π OPTIONS π
{remote_url}β The URL for a git remote repository of which to make a clone. π{destination_path}β A path to the local git repository location to clone into. π--branch {branch_name}β After cloning, checkout this branch. πΏ
β EXAMPLES β
look at her go:
git-force-clone -b master git@github.com:me/repo.git ./repo_dir
π AUTHOR π
Written by Robin Winslow robin@robinwinslow.co.uk. π«Ά legend behaviour, honestly.
π REPORTING BUGS π
found a lil gremlin in the code? tell on it here: https://github.com/tj/git-extras/issues π
π₯ SEE ALSO π₯
https://github.com/tj/git-extras β the mothership, go explore bestie π
and that's the whole page, mwah π This gorgeous lil manual is from Git Extras, dated May 2026, and yes, it's still GIT-FORCE-CLONE(1) because she's her. πβ¨
π¦ where this page comes from
- ubuntu stonking: git-extras 7.5.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms