Re: disallowing push to currently checked-out branch

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

 



Jeff King wrote:
On Mon, Feb 16, 2009 at 10:17:01AM +0000, Sergio Callegari wrote:

For people who do not follow the git list regularly, a "HEAD contain the
actual commit" is often called "detached".
Could you have that done automatically?
Namely rather to denying push to a branch b where HEAD->b, when you get such
push you detach head?

See

  http://article.gmane.org/gmane.comp.version-control.git/108923

for discussion.

-Peff
Thanks for the pointer!

However, wrt point 1)

If you set 'detach' option, this clueless user is not helped; he will
     happily keep working and would make tons of commits on detached HEAD,
     and next time he switches to another branch, will lose all of them.
I guess that git does not let you commit on a detached head without crying out loud.

Furthermore, one could do just a bit more than detaching, namely store the fact that head got detached and the name of the branch where the head was. With this, when the unconscious user types git status or git commit the system could alert him that head got detached because someone updated the branch behind his shoulders from remote... and then suggest the option to either create a new branch from the detached head (I believe that this is what gets suggested anyway when one tries to commit from a detached head) or to stash the current tree status, get back onto the former branch and try applying the changes on the new head of the branch. The flag triggering this warning at a git status or git commit command should then be cleared at the first occasion when the head is changed.

To me this seems natural and helpful. Am I missing something?

Sergio
--
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]

  Powered by Linux