Merge branch 'tg/worktree-create-tracking'
[gitweb.git] / Documentation / git-branch.txt
index de90fde378cf9500d1c230ca9f2caeebffac8c74..b3084c99c1cabdccc690e4cec5071b22774bf6c8 100644 (file)
@@ -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.
@@ -92,19 +97,19 @@ OPTIONS
        all changes made to the branch ref, enabling use of date
        based sha1 expressions such as "<branchname>@\{yesterday}".
        Note that in non-bare repositories, reflogs are usually
-       enabled by default by the `core.logallrefupdates` config option.
+       enabled by default by the `core.logAllRefUpdates` config option.
        The negated form `--no-create-reflog` only overrides an earlier
        `--create-reflog`, but currently does not negate the setting of
-       `core.logallrefupdates`.
+       `core.logAllRefUpdates`.
 
 -f::
 --force::
-       Reset <branchname> to <startpoint> if <branchname> exists
-       already. Without `-f` 'git branch' refuses to change an existing branch.
+       Reset <branchname> to <startpoint>, even if <branchname> exists
+       already. Without `-f`, 'git branch' refuses to change an existing branch.
        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`).
 
 -m::
 --move::
@@ -113,6 +118,13 @@ OPTIONS
 -M::
        Shortcut for `--move --force`.
 
+-c::
+--copy::
+       Copy a branch and the corresponding reflog.
+
+-C::
+       Shortcut for `--copy --force`.
+
 --color[=<when>]::
        Color branches to highlight current, local, and
        remote-tracking branches.
@@ -265,10 +277,16 @@ start-point is either a local or remote-tracking branch.
        Only list branches of the given object.
 
 --format <format>::
-       A string that interpolates `%(fieldname)` from the object
-       pointed at by a ref being shown.  The format is the same as
+       A string that interpolates `%(fieldname)` from a branch ref being shown
+       and the object it points at.  The format is the same as
        that of linkgit:git-for-each-ref[1].
 
+CONFIGURATION
+-------------
+`pager.branch` is only respected when listing branches, i.e., when
+`--list` is used or implied. The default is to use a pager.
+See linkgit:git-config[1].
+
 Examples
 --------