From: Junio C Hamano Date: Sun, 01 Oct 2017 03:49:38 GMT Subject: Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details Message-ID: In-Reply-To: "Robert P. J. Day" writes: > it's simply a matter of the forms not matching between the SYNOPSIS > and the DESCRIPTION sections. am i making sense? I think the whole thing is wrong and the root cause is because the (relatively newer) description of the "--patch" mode lazily tried to piggy-back the description of existing "check out from the index or tree-ish" mode, ending up in a confusing description. "git checkout [] -- ..." is a way to overwrite the working tree files with what is in the object store. When you give , the paths that match the are grabbed from the tree-ish, added to the index, and overwrites the working tree files. In this mode, you need to have at least one pathspec element on the command line, so is mandatory. With no pathspec, if happens to be a commit-ish, then the operation is "check out the commit, so that we can prepare to make a new commit as its child". "git checkout -p/--patch []" is quite different. It can be used without any to pick and choose from all changes treewide, but you can use to limit the changes you need to choose from. Something like the following may be a good starting point. As I didn't spend many brain-cycles to come up with a description for the "--patch" mode, that paragraph needs a total rewrite on top, but I think the structure to separate the normal "per-path" checkout mode and "patch" mode and describe it separately should make it a lot clearer to see what is being described. Short of such a fundamental correction, git checkout [-p|--patch] [] -- [...] would allow you to give none of -p/--patch/, which is totally a different operation from what is being described in the text. Documentation/git-checkout.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index d6399c0af8..3d88f703e9 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -13,7 +13,8 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] [--detach] 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=