{"thread":{"id":"24487","subject":"Replacing a Remote Branch","startedAt":"2010-07-23T20:14:51Z","lastAt":"2010-07-24T16:07:53Z","messageCount":7,"participants":["Eric James Michael Ritz","Thomas Rast","bill lam"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"146109","messageId":"4C49F83B.4060903@cybersprocket.com","threadId":"24487","inReplyTo":null,"subject":"Replacing a Remote Branch","fromName":"Eric James Michael Ritz","fromEmail":"eric@cybersprocket.com","sentAt":"2010-07-23T20:14:51Z","receivedAt":"2010-07-23T20:14:51Z","isPatch":false,"sender":{"key":"eric@cybersprocket.com","avatar":"https://gravatar.com/avatar/b2211d0a2fc3f3f4b458f9e389233af703452fb0c2d1563ace146bb668ae1455?d=mp&s=160"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\n\nHello everyone.  I have a question about pushing branches that I hope\na more experienced user could help me with.\n\nCommonly I run into this situation:\n\n  1. I have pushed a topic branch out to a repo where other developers\n  on my team push their work until its ready to be merged.\n\n  2. I realized I need to perform some ‘destructive’ action like\n  ‘rebase -i’ or amend the last commit to fix a typo in the message.\n\n  3. Then I want to push the changed branch as a replacement.\n\nCurrently I deal with this by running\n\n    $ git push origin :foo && git push origin foo\n\nto replace `foo`.  But is there a shorter way to do this?  I thought\nthat writing something like\n\n    $ git push origin +foo:foo\n\nmay have the intended effect, but I still get a rejection due to a\nnon-fast-forward, so I am likely misunderstanding the purpose of `+`.\n\nIf there is any short-cut for this, I would greatly appreciate it.\nAnd if not, writing a simple script is not a huge hassle :)\n\n- --\nEric James Michael Ritz\nCyber Sprocket Labs\n(843) 225-3830\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niQEcBAEBAgAGBQJMSfg7AAoJEEHUZXw5hMWshwAIALOnsArQIWoxXNmOVNvi3ptd\noXpUXbfX2ZgMnhOQAYmJXYjkqc/fKFh+MultDP1PRgQwPdPCEUfK/n5TEJXB66Jf\nnsgnGWIHk7nULuKJmCb9BrDd+xVI4tvbhI3gZYXrypoWdrfUat9rlUL52+eiAXp7\nCG/FQrSoFRydREGUuAi1UNtTPt9UG2MT65dEx/S8wqRn8phpJHZI94mKOVZ58lI1\noQDfx+Ox6p2RJG/HRrX7/jWOiGzMk3Ix/cToAaltBWWp7MgvDq31pjrN0TZJfUu+\n+vcgafAqseXDDuStlEGd8O5WT+uRYjn9/K3YHf55MKsMvKVzNxgS8IHQGzC+Yk4=\n=/0uY\n-----END PGP SIGNATURE-----\n"},{"id":"146110","messageId":"201007232248.49520.trast@student.ethz.ch","threadId":"24487","inReplyTo":"4C49F83B.4060903@cybersprocket.com","subject":"Re: Replacing a Remote Branch","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-23T20:48:48Z","receivedAt":"2010-07-23T20:48:48Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Eric James Michael Ritz wrote:\n>   2. I realized I need to perform some ‘destructive’ action like\n>   ‘rebase -i’ or amend the last commit to fix a typo in the message.\n> \n>   3. Then I want to push the changed branch as a replacement.\n[...]\n>     $ git push origin :foo && git push origin foo\n> \n> to replace `foo`.  But is there a shorter way to do this?  I thought\n> that writing something like\n> \n>     $ git push origin +foo:foo\n> \n> may have the intended effect, but I still get a rejection due to a\n> non-fast-forward, so I am likely misunderstanding the purpose of `+`.\n\nSince + overrides the non-ff check, this means that the remote side\nhas receive.denyNonFastForwards (see man git-config) enabled (or a\nhook to the same effect).  Deleting and pushing the new branch merely\ndefeats this refusal because it is no longer a branch *update*.\n\nYou should probably check why and by who receive.denyNonFastForwards\nwas set.  Git itself sets it if you use 'git init --shared', so that\nmay be one reason.\n\nNote that non-ff updates are generally a bad thing for everyone who\nhas work based on the affected branch.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"146114","messageId":"4C4A011A.40604@cybersprocket.com","threadId":"24487","inReplyTo":"201007232248.49520.trast@student.ethz.ch","subject":"Re: Replacing a Remote Branch","fromName":"Eric James Michael Ritz","fromEmail":"eric@cybersprocket.com","sentAt":"2010-07-23T20:52:42Z","receivedAt":"2010-07-23T20:52:42Z","isPatch":false,"sender":{"key":"eric@cybersprocket.com","avatar":"https://gravatar.com/avatar/b2211d0a2fc3f3f4b458f9e389233af703452fb0c2d1563ace146bb668ae1455?d=mp&s=160"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\n\nOn 07/23/2010 04:48 PM, Thomas Rast wrote:\n> Eric James Michael Ritz wrote:\n>>   2. I realized I need to perform some ‘destructive’ action like\n>>   ‘rebase -i’ or amend the last commit to fix a typo in the message.\n>>\n>>   3. Then I want to push the changed branch as a replacement.\n> [...]\n>>     $ git push origin :foo && git push origin foo\n>>\n>> to replace `foo`.  But is there a shorter way to do this?  I thought\n>> that writing something like\n>>\n>>     $ git push origin +foo:foo\n>>\n>> may have the intended effect, but I still get a rejection due to a\n>> non-fast-forward, so I am likely misunderstanding the purpose of `+`.\n>\n> Since + overrides the non-ff check, this means that the remote side\n> has receive.denyNonFastForwards (see man git-config) enabled (or a\n> hook to the same effect).  Deleting and pushing the new branch merely\n> defeats this refusal because it is no longer a branch *update*.\n>\n> You should probably check why and by who receive.denyNonFastForwards\n> was set.  Git itself sets it if you use 'git init --shared', so that\n> may be one reason.\n\nThat’s the reason then, `--shared` was used.\n\n> Note that non-ff updates are generally a bad thing for everyone who\n> has work based on the affected branch.\n\nWe make it a policy to never base work off individual developer’s\nbranches precisely for this reason, because we’re often making\ncleanups via rebase and such.\n\nThank you for the answer.\n\n- --\nEric James Michael Ritz\nCyber Sprocket Labs\n(843) 225-3830\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niQEcBAEBAgAGBQJMSgEVAAoJEEHUZXw5hMWsu1wIANwTnswKzd0pKub3zms1y2wv\nouv2TRvxvpQhKvVO2r+CjDohdH2BQQIa2FWa8g/bG7fQVvGby1xQkWNJYxypebrh\nGHHX3Q4uF6mNIqD+yC4AQNQdEywCDXL4lBqh0Q7Bo+6ZGhUtQIEp1vyWHQeHTLuZ\n8NhWd4PwE4z5ssGGKTzzvg2FgkWxtKrNaCVXfPTHpeh51J/Slt0Jfhw/i/zXNlGU\nBN0Jlnavhvr5IDbODCNB96KJQue1xLZv+mNNrINlY+TlHwNVyKlq2ui8zvG0vC0K\nOwwbOh6HlGV1sPReFfbObu6F9oxz6DMcmdHqNtedQPiAmm38EIuFFTa4H1CiYlM=\n=P2Zr\n-----END PGP SIGNATURE-----\n"},{"id":"146132","messageId":"20100724011752.GA3333@debian.b2j","threadId":"24487","inReplyTo":"201007232248.49520.trast@student.ethz.ch","subject":"Re: Replacing a Remote Branch","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2010-07-24T01:17:52Z","receivedAt":"2010-07-24T01:17:52Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"Птн, 23 Июл 2010, Thomas Rast писал(а):\n> Since + overrides the non-ff check, this means that the remote side\n> has receive.denyNonFastForwards (see man git-config) enabled (or a\n> hook to the same effect).  Deleting and pushing the new branch merely\n\nI also scratched my head why push --force failed to push an\namend/rebase branch to assembla.  IMO it would be nice to mention this\nreceive.denyNonFastForwards inside man git-push.\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n"},{"id":"146195","messageId":"ab7b73ce593846b083bf0f4c4c7de08fb6008a5e.1279986834.git.trast@student.ethz.ch","threadId":"24487","inReplyTo":"20100724011752.GA3333@debian.b2j","subject":"[PATCH 1/2] Document receive.denyDeleteCurrent","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-24T16:03:14Z","receivedAt":"2010-07-24T16:03:14Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"This option was introduced by 747ca24 (receive-pack:\nreceive.denyDeleteCurrent, 2009-02-08) but never documented.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/config.txt |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e75434b..fdb90c0 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1558,6 +1558,10 @@ receive.denyDeletes::\n \tIf set to true, git-receive-pack will deny a ref update that deletes\n \tthe ref. Use this to prevent such a ref deletion via a push.\n \n+receive.denyDeleteCurrent::\n+\tIf set to true, git-receive,pack will deny a ref update that\n+\tdeletes the currently checked out branch of a non-bare repository.\n+\n receive.denyCurrentBranch::\n \tIf set to true or \"refuse\", git-receive-pack will deny a ref update\n \tto the currently checked out branch of a non-bare repository.\n-- \n1.7.2.278.g76edd.dirty\n"},{"id":"146196","messageId":"10aba8f15aea6cff0d90ab4fbea023d7187f575c.1279986834.git.trast@student.ethz.ch","threadId":"24487","inReplyTo":"ab7b73ce593846b083bf0f4c4c7de08fb6008a5e.1279986834.git.trast@student.ethz.ch","subject":"[PATCH 2/2] Documentation/git-push: Explain status output in more detail","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-24T16:03:15Z","receivedAt":"2010-07-24T16:03:15Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Mention the effects of the receive.deny* family of options for the\n\"remote rejected\" case.  While there, also split up the explanation\ninto an easier-to-parse list format.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nI considered instead patching receive-pack to have more verbose\nmessages, but decided not to, because it's already very verbose (by\ngit standards anyway) and because a doc update has the advantage of\nimmediately showing up in the kernel.org-hosted copies instead of\nappearing in two years when hosting providers update their gits.\n\n\n Documentation/git-push.txt |   33 +++++++++++++++++++++++----------\n 1 files changed, 23 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex b68abff..658ff2f 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -200,16 +200,29 @@ summary::\n \tFor a successfully pushed ref, the summary shows the old and new\n \tvalues of the ref in a form suitable for using as an argument to\n \t`git log` (this is `<old>..<new>` in most cases, and\n-\t`<old>...<new>` for forced non-fast-forward updates). For a\n-\tfailed update, more details are given for the failure.\n-\tThe string `rejected` indicates that git did not try to send the\n-\tref at all (typically because it is not a fast-forward). The\n-\tstring `remote rejected` indicates that the remote end refused\n-\tthe update; this rejection is typically caused by a hook on the\n-\tremote side. The string `remote failure` indicates that the\n-\tremote end did not report the successful update of the ref\n-\t(perhaps because of a temporary error on the remote side, a\n-\tbreak in the network connection, or other transient error).\n+\t`<old>...<new>` for forced non-fast-forward updates).\n++\n+For a failed update, more details are given:\n++\n+--\n+rejected::\n+\tGit did not try to send the ref at all, typically because it\n+\tis not a fast-forward and you did not force the update.\n+\n+remote rejected::\n+\tThe remote end refused the update.  Usually caused by a hook\n+\ton the remote side, or because the remote repository has one\n+\tof the following safety options in effect:\n+\t`receive.denyCurrentBranch` (for pushes to the checked out\n+\tbranch), `receive.denyNonFastForwards` (for forced\n+\tnon-fast-forward updates), `receive.denyDeletes` or\n+\t`receive.denyDeleteCurrent`.  See linkgit:git-config[1].\n+\n+remote failure::\n+\tThe remote end did not report the successful update of the ref,\n+\tperhaps because of a temporary error on the remote side, a\n+\tbreak in the network connection, or other transient error.\n+--\n \n from::\n \tThe name of the local ref being pushed, minus its\n-- \n1.7.2.278.g76edd.dirty\n"},{"id":"146197","messageId":"ab7b73ce593846b083bf0f4c4c7de08fb6008a5e.1279987608.git.trast@student.ethz.ch","threadId":"24487","inReplyTo":"ab7b73ce593846b083bf0f4c4c7de08fb6008a5e.1279986834.git.trast@student.ethz.ch","subject":"[PATCH v1.1 1/2] Document receive.denyDeleteCurrent","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-24T16:07:53Z","receivedAt":"2010-07-24T16:07:53Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"This option was introduced by 747ca24 (receive-pack:\nreceive.denyDeleteCurrent, 2009-02-08) but never documented.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nArgh, there was a typo (\"receive,pack\") in the first version.  Why do\nI only notice them on the 4th reading.  Sorry for the noise.\n\n Documentation/config.txt |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e75434b..fdb90c0 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1558,6 +1558,10 @@ receive.denyDeletes::\n \tIf set to true, git-receive-pack will deny a ref update that deletes\n \tthe ref. Use this to prevent such a ref deletion via a push.\n \n+receive.denyDeleteCurrent::\n+\tIf set to true, git-receive-pack will deny a ref update that\n+\tdeletes the currently checked out branch of a non-bare repository.\n+\n receive.denyCurrentBranch::\n \tIf set to true or \"refuse\", git-receive-pack will deny a ref update\n \tto the currently checked out branch of a non-bare repository.\n-- \n1.7.2.278.g76edd.dirty\n"}]}