From: Junio C Hamano <gitster@pobox.com>
To: Christoph Bartoschek <bartoschek@gmx.de>
Cc: git@vger.kernel.org, Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: [PATCH] Proof-of-concept patch to remember what the detached HEAD was
Date: Sat, 17 Oct 2009 00:43:31 -0700 [thread overview]
Message-ID: <7vr5t2h3do.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <m49nq6-uk5.ln1@burns.bruehl.pontohonk.de> (Christoph Bartoschek's message of "Sat\, 17 Oct 2009 00\:36\:37 +0200")
Christoph Bartoschek <bartoschek@gmx.de> writes:
[jc: added Daniel back to cc list; please do not cull the cc list without
good reason]
> Daniel Barkalow wrote:
>
>> The upshot of the messages should be:
>>
>> $ git checkout origin/master
>> Since you can't actually change "origin/master" yourself, you'll just
>> be sightseeing unless you create a local branch to hold new local work.
>>
>> $ git branch
>> * (not a local branch, but "origin/master")
>>
>> $ git commit
>> You've been sightseeing "origin/master". The commit can't change that
>> value, so your commit isn't held in any branch. If you want to create
>> a branch to hold it, here's how.
> ...
> But then I was not able to verify that the checkout indeed matched the
> 1.3.0-beta. "git status" and "git branch" did not help here.
This is not going to help you, but "git reflog" would have helped here.
The reason my suggesting "git reflog" now won't help you is because the
word "reflog" does not connect the question "how did I get here" unless
and until you know git already; in other words, it is not your fault that
you got lost, but it is showing a wart in the UI.
If the question you were asking was "does the files I have in my work tree
after issuing that scary checkout actually match origin/1.3.0-beta?", you
could have asked that question in a more direct way, and the command to do
so is "git diff origin/1.3.0-beta". I do not think this would be asking
the user to be doing something unreasonably unintuitive.
If the question you were asking was (and it was not, from the description
of your experience, but you could be in that situation when you "return
some weeks later") "how does the checked out history relate to 1.3.0-beta?",
then there is a way to ask the question in a very direct way, and the
command to do so is "git show-branch HEAD origin/1.3.0-beta" (or give the
same argument to "gitk").
Although it is not _so_ unreasonable to expect "git status" to show the
information, I suspect it would not be practical. After all, whenever
somebody is lost, everything is "status". For a person who is lost and
does not know where in the history he is, it might be reasonable to expect
"status" to give the relationship between your HEAD and some branch/tag,
while for another person who was hit by "git gui" complaining that he has
too many loose objects, it might be reasonable for him to expect "status"
to give the number of loose objects in the repository. IOW, "status" is
too broad a word and following the path to cram everything into "status"
so that any new person who gets lost can get necessary infor from the
command will unfortunately lead to insanity.
The second item in the Daniel's transcript above may be an improvement but
I think it is a wrong economy to record and show 'but "origin/master"'
(which cannot be correct forever and has to be invalidated once the user
starts committing or resetting) in the message. I am wondering if a
similar effect to help new users can be had by rewording the message to:
$ git branch
* (not a local branch; see "git reflog" to learn how you got here)
The user can see how he got there even after doing something else after
the checkout (see Nico's write-up in $gmane/130527). The difference is
between giving fish and teaching how to catch one himself.
next prev parent reply other threads:[~2009-10-17 7:48 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-14 4:44 [PATCH] Proof-of-concept patch to remember what the detached HEAD was Daniel Barkalow
2009-10-14 5:07 ` Junio C Hamano
2009-10-14 5:08 ` Jeff King
2009-10-14 10:33 ` Johannes Schindelin
2009-10-14 15:39 ` Jeff King
2009-10-14 18:34 ` Junio C Hamano
2009-10-14 18:40 ` Jeff King
2009-10-14 15:56 ` Daniel Barkalow
2009-10-14 18:56 ` Jay Soffian
2009-10-14 19:15 ` Daniel Barkalow
2009-10-14 20:18 ` Nicolas Pitre
2009-10-14 20:37 ` Daniel Barkalow
2009-10-14 20:42 ` Junio C Hamano
2009-10-14 20:48 ` Nicolas Pitre
2009-10-14 22:34 ` Junio C Hamano
2009-10-14 23:09 ` Jeff King
2009-10-14 23:34 ` Nicolas Pitre
2009-10-15 0:56 ` Junio C Hamano
2009-10-15 1:47 ` Jeff King
2009-10-15 3:08 ` Nicolas Pitre
2009-10-15 4:21 ` Jeff King
2009-10-16 1:04 ` Johannes Schindelin
2009-10-16 1:36 ` Nicolas Pitre
2009-10-16 2:07 ` Johannes Schindelin
2009-10-16 2:45 ` Nicolas Pitre
2009-10-16 2:56 ` Junio C Hamano
2009-10-17 7:24 ` Sean Estabrooks
2009-10-26 22:22 ` Johannes Schindelin
2009-10-27 3:41 ` Nanako Shiraishi
2009-10-27 10:33 ` Making Git easy to use -- without RTFM, was " Johannes Schindelin
2009-10-27 17:58 ` Avery Pennarun
2009-10-16 0:53 ` Johannes Schindelin
2009-10-16 3:00 ` Junio C Hamano
2009-10-15 7:36 ` James Pickens
2009-10-15 12:54 ` Jakub Narebski
2009-10-15 14:11 ` Björn Steinbrink
2009-10-15 19:03 ` Nicolas Pitre
2009-10-15 15:36 ` Daniel Barkalow
2009-10-15 16:29 ` Michael J Gruber
2009-10-15 19:07 ` Nicolas Pitre
2009-10-15 19:22 ` Daniel Barkalow
2009-10-15 22:56 ` Thomas Rast
2009-10-15 18:51 ` Nicolas Pitre
2009-10-15 19:52 ` Junio C Hamano
2009-10-15 21:26 ` Jeff King
2009-10-15 21:54 ` Junio C Hamano
2009-10-15 22:08 ` Junio C Hamano
2009-10-15 23:16 ` Nicolas Pitre
2009-10-15 23:47 ` James Pickens
2009-10-16 0:34 ` Nicolas Pitre
2009-10-16 0:43 ` Johannes Schindelin
2009-10-16 5:03 ` Björn Steinbrink
2009-10-15 22:16 ` Jeff King
2009-10-15 22:17 ` Jeff King
2009-10-16 4:29 ` Björn Steinbrink
2009-10-16 6:02 ` Daniel Barkalow
2009-10-16 8:27 ` Björn Steinbrink
2009-10-16 15:44 ` Nicolas Pitre
2009-10-15 19:31 ` Daniel Barkalow
2009-10-15 20:34 ` Junio C Hamano
2009-10-15 21:35 ` Daniel Barkalow
2009-10-15 21:48 ` Nicolas Pitre
2009-10-16 12:15 ` Julian Phillips
2009-10-16 14:30 ` Björn Steinbrink
2009-10-16 17:31 ` Julian Phillips
2009-10-16 18:29 ` Daniel Barkalow
2009-10-16 19:05 ` Junio C Hamano
2009-10-16 19:48 ` Julian Phillips
2009-10-16 20:19 ` Nicolas Pitre
2009-10-17 15:15 ` Julian Phillips
2009-10-17 17:04 ` Björn Steinbrink
2009-10-17 17:35 ` Julian Phillips
2009-10-17 17:48 ` Björn Steinbrink
2009-10-17 22:28 ` Julian Phillips
2009-10-16 20:19 ` Junio C Hamano
2009-10-17 15:32 ` Julian Phillips
2009-10-17 17:43 ` Junio C Hamano
2009-10-17 22:19 ` Julian Phillips
2009-10-17 7:55 ` Björn Steinbrink
2009-10-17 8:11 ` Junio C Hamano
2009-10-17 8:40 ` Björn Steinbrink
2009-10-17 9:04 ` Junio C Hamano
2009-10-17 17:07 ` James Pickens
2009-10-17 19:41 ` Björn Steinbrink
2009-10-18 22:47 ` Junio C Hamano
2009-10-19 8:44 ` Björn Steinbrink
2009-10-17 15:02 ` Julian Phillips
2009-10-14 23:52 ` Eric Raible
2009-10-16 22:36 ` Christoph Bartoschek
2009-10-17 7:43 ` Junio C Hamano [this message]
2009-10-17 8:19 ` Björn Steinbrink
2009-10-17 17:42 ` Junio C Hamano
2009-10-17 20:35 ` Daniel Barkalow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vr5t2h3do.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=barkalow@iabervon.org \
--cc=bartoschek@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).