git branch
git branch [--color[=<when>] | --no-color] [--show-current]
[-v [--abbrev=<n> | --no-abbrev]]
[--column[=<options>] | --no-column] [--sort=<key>]
[--merged [<commit>]] [--no-merged [<commit>]]
[--contains [<commit>]] [--no-contains [<commit>]]
[--points-at <object>] [--format=<format>]
[(-r|--remotes) | (-a|--all)]
[--list] [<pattern>…]
git branch [--track[=(direct|inherit)] | --no-track] [-f]
[--recurse-submodules] <branch-name> [<start-point>]
git branch (--set-upstream-to=<upstream>|-u <upstream>) [<branch-name>]
git branch --unset-upstream [<branch-name>]
git branch (-m|-M) [<old-branch>] <new-branch>
git branch (-c|-C) [<old-branch>] <new-branch>
git branch (-d|-D) [-r] <branch-name>…
git branch --edit-description [<branch-name>]
-
list, create, or delete branches
if `–list` is given
-
existing branches are listed
current branch highlighed in green and marked with an asterisk branches checked out in linked worktrees will be highlighted in cyan marked with a plus sign
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 wildcard to restrict the output to matching branches
- if multiple patterns are given, a branch is shown if it matches any of the patterns
with `–contains`
-
shows only the branches that contain the named commit
- the branches whose tip commits are descendants of the named commit
with `–contains` inverts it with `–merged`
- only branches merged into the named commit will be listed
-
with `–no-merged`
-
only branches not merged into the named commit
-
if the <commit> argument is missing
- it defaults to HEAD
-
if the <commit> argument is missing