summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Evans <julia@jvns.ca>2025-09-10 19:14:23 +0000
committerJunio C Hamano <gitster@pobox.com>2025-09-10 14:32:03 -0700
commit21a5f9442e3a9640c46d3bc28b41a7238bb4ee9c (patch)
tree22fe8c3cbce6dbc70a443aaf9583cbb347dde86d
parentf814da676ae46aac5be0a98b99373a76dee6cedb (diff)
doc: git-checkout: clarify intro sentence
From user feedback: in the first paragraph, 5 users reported not understanding the terms "pathspec" and 1 user reported not understanding the term "HEAD". Of the users who said they didn't know what "pathspec" means, 3 said they couldn't understand what the paragraph was trying to communicate as a result. One user also commented that "If no pathspec was given..." makes `git checkout <branch>` sounds like a special edge case, instead of being one of the most common ways to use this core Git command. It looks like the goal of this paragraph is to communicate that `git checkout` has two different modes: one where you switch branches and one where you just update your working directory files/index. So say that directly, and use more familiar language (including examples) to say it. Signed-off-by: Julia Evans <julia@jvns.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Documentation/git-checkout.adoc10
1 files changed, 6 insertions, 4 deletions
diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc
index ff1cb29bc1..e0910bb59d 100644
--- a/Documentation/git-checkout.adoc
+++ b/Documentation/git-checkout.adoc
@@ -20,10 +20,12 @@ git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>...]
DESCRIPTION
-----------
-Updates files in the working tree to match the version in the index
-or the specified tree. If no pathspec was given, `git checkout` will
-also update `HEAD` to set the specified branch as the current
-branch.
+
+`git checkout` has two main modes:
+
+1. **Switch branches**, with `git checkout <branch>`
+2. **Restore a different version of a file**, for example with
+ `git checkout <commit> <filename>` or `git checkout <filename>`
`git checkout [<branch>]`::
To prepare for working on _<branch>_, switch to it by updating