Skip to content

Commit 2221a6b

Browse files
committed
doc: git-checkout: deduplicate --detach explanation
Right now the explanation of `--detach` repeats a lot of the content in the description of `git checkout <branch>`: we can communicate the same thing by saying "This is the same as `git checkout <branch>`, except..." Signed-off-by: Julia Evans <[email protected]>
1 parent 0a39152 commit 2221a6b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Documentation/git-checkout.adoc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,9 @@ that is, the branch will not be created or modified unless
7373
`git checkout --detach [<branch>]`::
7474
`git checkout [--detach] <commit>`::
7575
76-
Prepare to work on top of _<commit>_, by detaching `HEAD` at it
77-
(see "DETACHED HEAD" section), and updating the index and the
78-
files in the working tree. Local modifications to the files
79-
in the working tree are kept, so that the resulting working
80-
tree will be the state recorded in the commit plus the local
81-
modifications.
82-
+
83-
When the _<commit>_ argument is a branch name, the `--detach` option can
84-
be used to detach `HEAD` at the tip of the branch (`git checkout
85-
<branch>` would check out that branch without detaching `HEAD`).
76+
The same as `git checkout <branch>`, except that instead of pointing
77+
`HEAD` at the branch, it points `HEAD` at the commit ID.
78+
See the "DETACHED HEAD" section below for more.
8679
+
8780
Omitting _<branch>_ detaches `HEAD` at the tip of the current branch.
8881

0 commit comments

Comments
 (0)