From: Junio C Hamano Date: Sat, 17 Oct 2009 17:42:53 GMT Subject: Re: [PATCH] Proof-of-concept patch to remember what the detached HEAD was Message-ID: <7vr5t17w82.fsf@alter.siamese.dyndns.org> In-Reply-To: <20091017081901.GB5474@atjola.homenet> Björn Steinbrink writes: > On 2009.10.17 00:43:31 -0700, Junio C Hamano wrote: >> Christoph Bartoschek writes: >> > 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. > > [...] > >> 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 don't think it's entirely wrong to record that information, git just > has to know when to invalidate it, possibly requiring the user to really > detach HEAD. Isn't it redundant information to begin with? See $gmane/130527 > git checkout origin/master > git checkout origin/master~3 > git checkout HEAD^2~5 > git reset --hard HEAD~2 > > Those commands are all about walking the ancestry of origin/master in > some way. So it seems reasonable to assume that HEAD is still weakly > bound to origin/master. But as "walking" gets longer, the information will become less and less relevant and at some point it becomes misleading. I cannot explain why "let's take pains to maintain and carefully invalidate an extra piece of redundant information so that we can show information the end user shouldn't be trained to trust to begin with because it is unreliable" is a good idea.