Skip to content

Commit cec8d14

Browse files
author
Junio C Hamano
committed
Documentation: Moving out of detached HEAD does not warn anymore.
The documentation still talked about the unnecessary 'safety' in git-checkout. Pointed out by Matthias Lederhofer. Signed-off-by: Junio C Hamano <[email protected]>
1 parent bd3a5b5 commit cec8d14

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

Documentation/git-checkout.txt

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,12 @@ by any branch (which is natural --- you are not on any branch).
103103
What this means is that you can discard your temporary commits
104104
and merges by switching back to an existing branch (e.g. `git
105105
checkout master`), and a later `git prune` or `git gc` would
106-
garbage-collect them.
107-
108-
The command would refuse to switch back to make sure that you do
109-
not discard your temporary state by mistake when your detached
110-
HEAD is not pointed at by any existing ref. If you did want to
111-
save your state (e.g. "I was interested in the fifth commit from
112-
the top of 'master' branch", or "I made two commits to fix minor
113-
bugs while on a detached HEAD" -- and if you do not want to lose
114-
these facts), you can create a new branch and switch to it with
115-
`git checkout -b newbranch` so that you can keep building on
116-
that state, or tag it first so that you can come back to it
117-
later and switch to the branch you wanted to switch to with `git
118-
tag that_state; git checkout master`. On the other hand, if you
119-
did want to discard the temporary state, you can give `-f`
120-
option (e.g. `git checkout -f master`) to override this
121-
behaviour.
106+
garbage-collect them. If you did this by mistake, you can ask
107+
the reflog for HEAD where you were, e.g.
108+
109+
------------
110+
$ git log -g -2 HEAD
111+
------------
122112

123113

124114
EXAMPLES

0 commit comments

Comments
 (0)