1GIT-FORCE-CLONE(1) Git Extras GIT-FORCE-CLONE(1)
2
3
4
6 git-force-clone - overwrite local repositories with clone
7
9 force-clone --help force-clone {remote_url} {destination_path}
10 force-clone --branch {branch_name} {remote_url} {destination_path}
11
13 Provides the basic functionality of git clone, but if the destination
14 git repository already exists it will force-reset it to resemble a
15 clone of the remote.
16
17 Because it doesn´t actually delete the directory, it is usually signif‐
18 icantly faster than the alternative of deleting the directory and
19 cloning the repository from scratch.
20
21 CAUTION: If the repository exists, this will destroy all local work:
22 changed files will be reset, local branches and other remotes will be
23 removed.
24
26 If target-directory doesn´t exist or isn´t a git repository then the
27 arguments will simply be passed through to git clone.
28
29 If target-directory exists and is a git repository then this will:
30
31 · Remove all remotes
32
33 · Set the origin remote to {remote_url} and fetch the remote
34
35 · Discover the default branch, if no branch was specified
36
37 · Check out the selected branch
38
39 · Delete all other local branches
40
41
42
44 {remote_url} - The URL for a git remote repository of which to make a
45 clone. {destination_path} - A path to the local git repository location
46 to clone into. --branch {branch_name} - After cloning, checkout this
47 branch.
48
50 git-force-clone -b master git@github.com:me/repo.git ./repo_dir
51
53 Written by Robin Winslow robin@robinwinslow.co.uk.
54
56 https://github.com/tj/git-extras/issues
57
59 https://github.com/tj/git-extras
60
61
62
63 October 2017 GIT-FORCE-CLONE(1)