git-force-clone - Man Page

overwrite local repositories with clone

Examples (TL;DR)


force-clone --help
force-clone {remote_url} {destination_path}
force-clone --branch {branch_name} {remote_url} {destination_path}


Provides the basic functionality of git clone, but if the destination git repository already exists it will force-reset it to resemble a clone of the remote.

Because it doesn´t actually delete the directory, it is usually significantly faster than the alternative of deleting the directory and cloning the repository from scratch.

CAUTION: If the repository exists, this will destroy all local work: changed files will be reset, local branches and other remotes will be removed.


If target-directory doesn´t exist or isn´t a git repository then the arguments will simply be passed through to git clone.

If target-directory exists and is a git repository then this will:


{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.


git-force-clone -b master ./repo_dir


Written by Robin Winslow

Reporting Bugs

See Also

Referenced By


August 2021 Git Extras