git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Replacing a Remote Branch

From
Eric James Michael Ritz <eric@cybersprocket.com>
Date
Jul 23, 2010, 20:52 UTC
Message-ID
<4C4A011A.40604@cybersprocket.com>
In-Reply-To
<201007232248.49520.trast@student.ethz.ch>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/23/2010 04:48 PM, Thomas Rast wrote:
Show 24 quoted lines
> 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.
> [...]
>>     $ 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.
That’s the reason then, `--shared` was used.
> Note that non-ff updates are generally a bad thing for everyone who
> has work based on the affected branch.

We make it a policy to never base work off individual developer’s branches precisely for this reason, because we’re often making cleanups via rebase and such.

Thank you for the answer.
- --
Eric James Michael Ritz
Cyber Sprocket Labs
(843) 225-3830
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMSgEVAAoJEEHUZXw5hMWsu1wIANwTnswKzd0pKub3zms1y2wv ouv2TRvxvpQhKvVO2r+CjDohdH2BQQIa2FWa8g/bG7fQVvGby1xQkWNJYxypebrh GHHX3Q4uF6mNIqD+yC4AQNQdEywCDXL4lBqh0Q7Bo+6ZGhUtQIEp1vyWHQeHTLuZ 8NhWd4PwE4z5ssGGKTzzvg2FgkWxtKrNaCVXfPTHpeh51J/Slt0Jfhw/i/zXNlGU BN0Jlnavhvr5IDbODCNB96KJQue1xLZv+mNNrINlY+TlHwNVyKlq2ui8zvG0vC0K OwwbOh6HlGV1sPReFfbObu6F9oxz6DMcmdHqNtedQPiAmm38EIuFFTa4H1CiYlM= =P2Zr -----END PGP SIGNATURE-----

Previous: Thomas RastNext: bill lam
Message 3 of 7 in “Replacing a Remote Branch”
  1. Eric James Michael RitzJul 23, 2010
  2. Thomas RastJul 23, 2010
  3. Eric James Michael RitzJul 23, 2010
  4. bill lamJul 24, 2010
  5. 1/2 Document receive.denyDeleteCurrentThomas Rast, Jul 24, 2010
  6. 2/2 Documentation/git-push: Explain status output in more detailThomas Rast, Jul 24, 2010
  7. 1/2 Document receive.denyDeleteCurrentThomas Rast, Jul 24, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.