tj.git-extras/man/git-force-clone.1
Robin Winslow 71a12810e0 Be explicit about only resetting git directories
This expects a target git directory. If it's not a git directory,
(e.g. a simple directory) then it will pass through to
`git clone` which will raise an error.

Here I'm clarifying that this tool will reset local *git directories* specifically.
2016-10-29 17:24:18 +01:00

58 lines
2 KiB
Groff

.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-FORCE\-CLONE" "1" "2016-10-29" "" "Git Extras"
.
.SH "NAME"
\fBgit\-force\-clone\fR \- overwrite local repositories with clone
.
.SH "SYNOPSIS"
\fBforce\-clone \-\-help\fR \fBforce\-clone {remote_url} {destination_path}\fR \fBforce\-clone \-\-branch {branch_name} {remote_url} {destination_path}\fR
.
.SH "DESCRIPTION"
Provides the basic functionality of \fBgit clone\fR, but if the destination git repository already exists it will force\-reset it to resemble a clone of the remote\.
.
.P
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\.
.
.P
\fBCAUTION\fR: If the repository exists, this will destroy \fIall\fR local work: changed files will be reset, local branches and other remotes will be removed\.
.
.SH "PROCESS"
If \fBtarget\-directory\fR doesn\'t exist or isn\'t a git repository then the arguments will simply be passed through to \fBgit clone\fR\.
.
.P
If \fBtarget\-directory\fR exists and is a git repository then this will:
.
.IP "\(bu" 4
Remove all remotes
.
.IP "\(bu" 4
Set the origin remote to \fB{remote_url}\fR and fetch the remote
.
.IP "\(bu" 4
Discover the default branch, if no branch was specified
.
.IP "\(bu" 4
Check out the selected branch
.
.IP "\(bu" 4
Delete all other local branches
.
.IP "" 0
.
.SH "OPTIONS"
\fB{remote_url}\fR \- The URL for a git remote repository of which to make a clone\. \fB{destination_path}\fR \- A path to the local git repository location to clone into\. \fB\-\-branch {branch_name}\fR \- After cloning, checkout this branch\.
.
.SH "EXAMPLES"
\fBgit\-force\-clone \-b master git@github\.com:me/repo\.git \./repo_dir\fR
.
.SH "AUTHOR"
Written by Robin Winslow \fIrobin@robinwinslow\.co\.uk\fR\.
.
.SH "REPORTING BUGS"
\fIhttps://github\.com/tj/git\-extras/issues\fR
.
.SH "SEE ALSO"
\fIhttps://github\.com/tj/git\-extras\fR