Re: disallowing push to currently checked-out branch
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:12
Hi, On Mon, 16 Feb 2009, Sergio Callegari wrote:
Jeff King wrote:quoted
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.
Wrong. It cries out loud when you detach, not when you commit to a detached HEAD. For good reason: Already at the second commit it would stop being funny.
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 of course, you need a way to show the user all the updates the branch went through while the HEAD was detached, so that the user has a chance of understanding what happened in the meantime. So much additional work, just to fix up the shortcomings of the 'detach' paradigm? I take it as a clear mark of a not-so-elegant design. Ciao, Dscho