From: Julia Evans Date: Wed, 10 Sep 2025 19:14:29 +0000 (+0000) Subject: doc: git-checkout: clarify restoring files section X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83a9405e59e9cdfb587b19c50f0c040f346dd4ea;p=thirdparty%2Fgit.git doc: git-checkout: clarify restoring files section From user feedback on this section: 3 users don't know what "tree-ish" means and 3 users don't know what "pathspec" means. One user also says that the section is very confusing and that they don't understand what the "index" is. From conversations on Mastodon, several users said that their impression is that "the index" means the same thing as "HEAD". It would be good to give those users (and other users who do not know what "index" means) a hint as to its meaning. Make this section more accessible to users who don't know what the terms "pathspec", "tree-ish", and "index" mean by using more familiar language, adding examples, and using simpler sentence structures. Signed-off-by: Julia Evans Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc index afc1880365..431185ca0b 100644 --- a/Documentation/git-checkout.adoc +++ b/Documentation/git-checkout.adoc @@ -75,22 +75,29 @@ Omitting __ detaches `HEAD` at the tip of the current branch. `git checkout [--] ...`:: `git checkout --pathspec-from-file= [--pathspec-file-nul]`:: - Overwrite both the index and the working tree with the - contents at the __ for the files that match the pathspec. + Replace the specified files and/or directories with the version from + the given commit or tree and add them to the index + (also known as "staging area"). ++ +For example, `git checkout main file.txt` will replace `file.txt` +with the version from `main`. `git checkout [-f|--ours|--theirs|-m|--conflict=