]> git.ipfire.org Git - thirdparty/git.git/commit
doc: git-checkout: clarify `git checkout <branch>`
authorJulia Evans <julia@jvns.ca>
Wed, 10 Sep 2025 19:14:25 +0000 (19:14 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Sep 2025 21:32:04 +0000 (14:32 -0700)
commitab215e4a8d14624c274319883c4b74956b24b0f0
tree23667c7edb99df49716e08feddeeea3f2c11c712
parentea03d5ae5cf7b256eca80634b424d3555da2cb8f
doc: git-checkout: clarify `git checkout <branch>`

From user feedback: several users commented that "Local modifications
to the files in the working tree are kept, so that they can be committed
to the <branch>." didn't seem accurate to them, since
`git checkout <branch>` will often fail.

One user also thought that "... and by pointing HEAD at the branch"
was something that _they_ had to do somehow ("How do I point HEAD at
a branch?") rather than a description of what the `git checkout`
operation is doing for them.

Explain when `git checkout <branch>` will fail and clarify that
"pointing HEAD at the branch" is part of what the command does.

6 users commented that the "You could omit <branch>..." section is
extremely confusing. Explain this in a much more direct way.

Signed-off-by: Julia Evans <julia@jvns.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-checkout.adoc