path: root/Documentation/git-branch.txt
diff options
authorJunio C Hamano <>2017-10-03 06:42:48 (GMT)
committerJunio C Hamano <>2017-10-03 06:42:48 (GMT)
commit3b48045c6c73a51834a2f83440a30225485ee431 (patch)
treeca7e9460aaadd4e6f26414c86bd72df6ab371fb8 /Documentation/git-branch.txt
parentb2a2c4d8099c69ec997e51cac489c0947ad17956 (diff)
parente5435ff1fc64d93cce73ec4ee2571219384a92a9 (diff)
Merge branch 'sd/branch-copy'
"git branch" learned "-c/-C" to create a new branch by copying an existing one. * sd/branch-copy: branch: fix "copy" to never touch HEAD branch: add a --copy (-c) option to go with --move (-m) branch: add test for -m renaming multiple config sections config: create a function to format section headers
Diffstat (limited to 'Documentation/git-branch.txt')
1 files changed, 13 insertions, 1 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 58f1e5c..fe029ac 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -18,6 +18,7 @@ SYNOPSIS
'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
'git branch' --unset-upstream [<branchname>]
'git branch' (-m | -M) [<oldbranch>] <newbranch>
+'git branch' (-c | -C) [<oldbranch>] <newbranch>
'git branch' (-d | -D) [-r] <branchname>...
'git branch' --edit-description [<branchname>]
@@ -64,6 +65,10 @@ If <oldbranch> had a corresponding reflog, it is renamed to match
renaming. If <newbranch> exists, -M must be used to force the rename
to happen.
+The `-c` and `-C` options have the exact same semantics as `-m` and
+`-M`, except instead of the branch being renamed it along with its
+config and reflog will be copied to a new name.
With a `-d` or `-D` option, `<branchname>` will be deleted. You may
specify more than one branch for deletion. If the branch currently
has a reflog then the reflog will also be deleted.
@@ -104,7 +109,7 @@ OPTIONS
In combination with `-d` (or `--delete`), allow deleting the
branch irrespective of its merged status. In combination with
`-m` (or `--move`), allow renaming the branch even if the new
- branch name already exists.
+ branch name already exists, the same applies for `-c` (or `--copy`).
@@ -113,6 +118,13 @@ OPTIONS
Shortcut for `--move --force`.
+ Copy a branch and the corresponding reflog.
+ Shortcut for `--copy --force`.
Color branches to highlight current, local, and
remote-tracking branches.