logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

git-force-clone - overwrite local repositories with clone

Author

       Written by Robin Winslow robin@robinwinslow.co.uk.

Description

       Provides  the  basic  functionality of gitclone, 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.

Examples

git-force-clone-bmastergit@github.com:me/repo.git./repo_dir

Name

git-force-clone - overwrite local repositories with clone

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.

Process

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

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

       •   Remove all remotes

       •   Set the origin remote 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

Reporting Bugs

https://github.com/tj/git-extras/issues

See Also

https://github.com/tj/git-extras

                                                  October 2024                                GIT-FORCE-CLONE(1)

Synopsis

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

See Also