`--patch` mode.
+
Note that this option uses the no overlay mode by default (see also
`--overlay`), and currently doesn't support overlay mode.
`--ignore-other-worktrees`::
`git checkout` refuses when the wanted branch is already checked
out or otherwise in use by another worktree. This option makes
it check the branch out anyway. In other words, the branch can
be in use by more than one worktree.
`--overwrite-ignore`::
`--no-overwrite-ignore`::
Silently overwrite ignored files when switching branches. This
is the default behavior. Use `--no-overwrite-ignore` to abort
the operation when the new branch contains ignored files.
`--recurse-submodules`::
`--no-recurse-submodules`::
Using `--recurse-submodules` will update the content of all active
submodules according to the commit recorded in the superproject. If
local modifications in a submodule would be overwritten the checkout
will fail unless `-f` is used. If nothing (or `--no-recurse-submodules`)
is used, submodules working trees will not be updated.
Just like linkgit:git-submodule[1], this will detach `HEAD` of the
submodule.
`--overlay`::
`--no-overlay`::
In the default overlay mode, `git checkout` never
removes files from the index or the working tree. When
specifying `--no-overlay`, files that appear in the index and
working tree, but not in _<tree-ish>_ are removed, to make them
match _<tree-ish>_ exactly.
`--pathspec-from-file=<file>`::
Pathspec is passed in _<file>_ instead of commandline args. If
_<file>_ is exactly `-` then standard input is used. Pathspec
elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
global `--literal-pathspecs`.
`--pathspec-file-nul`::
Only meaningful with `--pathspec-from-file`. Pathspec elements are
separated with _NUL_ character and all other characters are taken
literally (including newlines and quotes).
<branch>::
Branch to checkout; if it refers to a branch (i.e., a name that,
when prepended with "refs/heads/", is a valid ref), then that
branch is checked out. Otherwise, if it refers to a valid
commit, your `HEAD` becomes "detached" and you are no longer on
any branch (see below for details).
+
You can use the `@{-N}` syntax to refer to the N-th last
branch/commit checked out using "git checkout" operation. You may
also specify `-` which is synonymous to `@{-1}`.
+
As a special case, you may use `<rev-a>...<rev-b>` as a shortcut for the
merge base of _<rev-a>_ and _<rev-b>_ if there is exactly one merge base. You can
leave out at most one of _<rev-a>_ and _<rev-b>_, in which case it defaults to `HEAD`.
_<new-branch>_::
Name for the new branch.
_<start-point>_::
The name of a commit at which to start the new branch; see
linkgit:git-branch[1] for details. Defaults to `HEAD`.
+
As a special case, you may use `<rev-a>...<rev-b>` as a shortcut for the
merge base of _<rev-a>_ and _<rev-b>_ if there is exactly one merge base. You can
leave out at most one of _<rev-a>_ and _<rev-b>_, in which case it defaults to `HEAD`.
_<tree-ish>_::
Tree to checkout from (when paths are given). If not specified,
the index will be used.
+
As a special case, you may use `<rev-a>...<rev-b>` as a shortcut for the
merge base of _<rev-a>_ and _<rev-b>_ if there is exactly one merge base. You can
leave out at most one of _<rev-a>_ and _<rev-b>_, in which case it defaults to `HEAD`.
`--`::
Do not interpret any more arguments as options.
`<pathspec>...`::
Limits the paths affected by the operation.
+
For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
DETACHED HEAD
-------------
`HEAD` normally refers to a named branch (e.g. `master`). Meanwhile, each
branch refers to a specific commit. Let's look at a repo with three
commits, one of them tagged, and with branch `master` checked out:
------------
HEAD (refers to branch 'master')