From: Julia Evans via GitGitGadget Date: Wed, 10 Sep 2025 19:14:29 GMT Subject: [PATCH v4 7/7] doc: git-checkout: clarify restoring files section Message-ID: In-Reply-To: From: Julia Evans 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 --- Documentation/git-checkout.adoc | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc index 1e19e13a0e..d8e8bcf549 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=