Re: [PATCH/RFC] builtin-checkout: suggest creating local branch when appropriate to do so
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 26, 2009, 07:14 UTC
- Message-ID
- <7vbpjupqy5.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <4AE48F88.1030108@gmail.com>
Uri Okrent <uokrent@gmail.com> writes:
Show 14 quoted lines
> Junio C Hamano wrote: >> In this sequence: >> >> 1$ git checkout $commit_name_that_is_not_a_local_branch >> 2$ git commit; hack; hack; hack;... >> 3$ git checkout $branch_name >> [...] >> Step #3 is where the state built in the detached HEAD "branch" vanishes >> into lost-found. >> >> The experts argued that #3 is where it is dangerous... > > If step 3 is where the danger lies, wouldn't it then be most appropriate to put > the warning message there?
You already get reminded that you were on a detached HEAD in step #3.
The primary point of the message you are replying to was that I do not agree with the view that step #3 is the most problematic step. The existing reminder would help people who read it and are capable of realizing "ah, I started it on a throw-away branch but ended up with something I would rather keep" and doing "git branch topic HEAD@{1}".
It will not help people who haven't got enough clue yet to know what a detached HEAD is, or you can refer to your previous point with HEAD@{1} notation. We do give brief advice at step #1 to alleviate this issue.