Re: What's cooking in git.git (Feb 2011, #06; Sun, 27)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sverre Rabbelier <srabbelier@xxxxxxxxx> writes:

> Heya,
>
> On Mon, Feb 28, 2011 at 07:48, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> * jc/checkout-orphan-warning (2011-02-18) 1 commit
>>  - commit: give final warning when reattaching HEAD to leave commits behind
>>
>> Likes, dislikes?
>
> I can't find a message containing this commit title, can you link to
> the relevant thread?

This is a re-roll of a fallout from this thread:

    http://thread.gmane.org/gmane.comp.version-control.git/166595/focus=167133

I do think the safety net for detached HEAD is a bit too flimsy, and that
is the motivation behind this.

As I don't think it is necessarily a good idea to attempt to make every
possible operation revertible (e.g., I do not think "oops, I did 'git add'
and I have only "git lost-and-found" to find the old index entry" is a
problem worth solving with extra complexity and storage cost), we should
strike a good balance by adding safety only at key places in reasonable
workflows (as opposed to every step to clutter the "undo log").

I am not convinced that this patch nailed that balance at exactly the
right place, even though I think we are getting closer than before.  In
this sequence:

    $ git checkout somewhere^0
    $ git commit
    $ git reset --hard somewhere_else
    $ git commit
    $ git checkout master

The second commit is protected with the patch, but not the first one,
which is still protected by the reflog on HEAD (i.e. "git log -g HEAD").
You have to know the reflog on HEAD if you _intend to_ work on detached
HEAD anyway, and you don't need this patch if you do---the second commit
can also be recovered from the reflog on HEAD.

So this patch is not about helping people who _chose to_ work on detached
HEAD; instead the patch in its current form is about helping sightseers
who has become _only_ a bit adventurous.  To help people who accidentally
started from a detached state (i.e. starting from sightseeing but then got
very adventurous, forgetting that they are not on any branch) and spent
significant amount of time committing and resetting, the advice message
should teach them to use "log -g HEAD" more explicitly, instead of giving
details of the last state (i.e. "you are leaving %n commits behind...").
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]