Re: Replacing a Remote Branch
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Jul 23, 2010, 20:48 UTC
- Message-ID
- <201007232248.49520.trast@student.ethz.ch>
- In-Reply-To
- <4C49F83B.4060903@cybersprocket.com>
Eric James Michael Ritz wrote:
> 2. I realized I need to perform some ‘destructive’ action like > ‘rebase -i’ or amend the last commit to fix a typo in the message. > > 3. Then I want to push the changed branch as a replacement.
[...]
Show 9 quoted lines
> $ git push origin :foo && git push origin foo > > to replace `foo`. But is there a shorter way to do this? I thought > that writing something like > > $ git push origin +foo:foo > > may have the intended effect, but I still get a rejection due to a > non-fast-forward, so I am likely misunderstanding the purpose of `+`.
Since + overrides the non-ff check, this means that the remote side has receive.denyNonFastForwards (see man git-config) enabled (or a hook to the same effect). Deleting and pushing the new branch merely defeats this refusal because it is no longer a branch *update*.
You should probably check why and by who receive.denyNonFastForwards was set. Git itself sets it if you use 'git init --shared', so that may be one reason.
Note that non-ff updates are generally a bad thing for everyone who has work based on the affected branch.
--
Thomas Rast
trast@{inf,student}.ethz.ch