git-branch - List, create, or delete branches
SYNOPSIS git branch [--color[=<when>] | --no-color] [-r | -a] [--list] [-v [--abbrev=<length> | --no-abbrev]] [--column[=<options>] | --no-column] [--sort=<key>] [(--merged | --no-merged) [<commit>]] [--contains [<commit]] [--no-contains [<commit>]] [--points-at <object>] [--format=<format>] [<pattern>…?] git branch [--track | --no-track] [-f] <branchname> [<start-point>] 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>]
DESCRIPTION If --list is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an asterisk. Option -r causes the remote-tracking branches to be listed. Option -a shows both local and remote branches. If a <pattern> is given, it is used as a shell wildcard to restrict the output to matching branches. If multiple patterns are given, a branch is shown if it matches any of the patterns. Note that when providing a<pattern> , you must use --list ; otherwise the command is interpreted as branch creation. With --contains , shows only the branches that contain the named commit(in other words, the branches whose tip commits are descendants of the named commit), --no-contains inverts it. With --merged , only branches merged into the named commit (i.e. the branches whose tip commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named commit will be listed. If the <commit>argument is missing it defaults to HEAD (i.e. the tip of the current branch). The command’s second form creates a new branch head named <branch name>which points to the current HEAD , or <start-point> if given. Note that this will create the new branch, but it will not switch the working tree to it; use 'git checkout <new branch>' to switch to the new branch. When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch. This behavior may be changed via the global branch.autoSetup Merge configuration flag. That setting can be overridden by using the --track and --no-track options, and changed later using git branch --set-upstream-to . With a -m or -M option, <old branch> will be renamed to <new branch>.If <old branch> had a corresponding reflog, it is renamed to match<new branch>, and a reflog entry is created to remember the branch renaming. If <new branch> 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. Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist in the remote repository or if git fetch was configured not to fetch them again. See also the prune subcommand of git-remote[1] for away to clean up all obsolete remote-tracking branches.
|