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