Re: disallowing push to currently checked-out branch
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- Feb 16, 2009, 08:33 UTC
- Message-ID
- <alpine.LNX.1.00.0902160322530.19665@iabervon.org>
- In-Reply-To
- <alpine.DEB.1.10.0902151738450.14911@asgard.lang.hm>
On Sun, 15 Feb 2009, david@lang.hm wrote:
> If there is some reason for the normal push to try and update the HEAD, index, > and workdir. instead of refusing the push, how about having it put the commits > in the repository and then fail to change the HEAD, index, and workdir if any > of them contain changes? (along with a warning that it's doing so).
A push cannot help but update HEAD, because HEAD is generally literally "ref: refs/heads/<current-branch>"; it doesn't store its own value, and the storage that it references is the storage that push is updating.
In fact, if you expect to be pushing to a non-bare repository, you probably want to have HEAD contain the actual commit currently checked out (instead of a reference to externally mutable storage), which you can do with "git checkout refs/heads/master".
-Daniel *This .sig left intentionally blank*