{"thread":{"id":"29331","subject":"git svn dcommit sends to wrong branch","startedAt":"2012-01-10T16:18:43Z","lastAt":"2012-01-26T15:27:38Z","messageCount":5,"participants":["Victor Engmark","Thomas Rast","badgerhardy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"182253","messageId":"20120110161843.GC8196@victor","threadId":"29331","inReplyTo":null,"subject":"git svn dcommit sends to wrong branch","fromName":"Victor Engmark","fromEmail":"victor.engmark@terreactive.ch","sentAt":"2012-01-10T16:18:43Z","receivedAt":"2012-01-10T16:18:43Z","isPatch":false,"sender":{"key":"victor.engmark@terreactive.ch","avatar":null},"body":"Commands:\n\ngit svn clone -s -r 1:HEAD http://svn/repo\ncd repo\ngit commit [thrice, in master only]\ngit rebase --interactive HEAD~20 [i.e., started rebase in commits before\nthe clone]\n[Merged two commits I had made *after* the clone]\ngit commit ...\ngit dcommit\n\nThis created commits on\n<http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's\ngit-svn-id <http://svn/repo/branches/branch_name@22481> is on that\nbranch?\n\nAnd more importantly, how do I \"replay\" my commits on trunk?\n\n-- \nterreActive AG\nKasinostrasse 30\nCH-5001 Aarau\nTel: +41 62 834 00 55\nFax: +41 62 823 93 56\nwww.terreactive.ch\n\nWir sichern Ihren Erfolg - seit 15 Jahren\n"},{"id":"182274","messageId":"87ty438ht3.fsf@thomas.inf.ethz.ch","threadId":"29331","inReplyTo":"20120110161843.GC8196@victor","subject":"Re: git svn dcommit sends to wrong branch","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-01-10T19:43:20Z","receivedAt":"2012-01-10T19:43:20Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Victor Engmark <victor.engmark@terreactive.ch> writes:\n\n> Commands:\n>\n> git svn clone -s -r 1:HEAD http://svn/repo\n> cd repo\n> git commit [thrice, in master only]\n\nWhich git version is this?  Before 1.6.5 (b186a261 to be precise)\ngit-svn pointed master at the branch where the last commit in SVN\nhappened, which is not necessarily trunk.  After that it tries to point\nit at trunk instead.  You can find out, e.g., by saying 'git show' on\nthe fresh clone and looking at the git-svn-id line.\n\n> git rebase --interactive HEAD~20 [i.e., started rebase in commits before\n> the clone]\n> [Merged two commits I had made *after* the clone]\n> git commit ...\n> git dcommit\n>\n> This created commits on\n> <http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's\n> git-svn-id <http://svn/repo/branches/branch_name@22481> is on that\n> branch?\n\nThe rule is that the commits go to the branch named in the git-svn-id\nline of the most recent first-parent ancestor of HEAD.\n\nYou can find the \"base\" commit in question with\n\n  git log -1 --first-parent --grep=^git-svn-id:\n\n> And more importantly, how do I \"replay\" my commits on trunk?\n\nYou need to rebase the commits on trunk, and (very important) strip the\ngit-svn-id lines from their messages.  If you only had a handful of\ncommits, your best bet is to use something like\n\n  git checkout -b newbranch\n  git rebase -i --onto svn/trunk svn/branch_name  # or whatever git-svn named the remote branches\n  # edit all the 'pick' into 'reword'\n  # in every commit message editor that pops up, remove the git-svn-id line\n\n  gitk  # make sure that you like the resulting history!\n  git svn dcommit\n\n(If you have many commits, git-filter-branch can do the removal\nautomatically, but it's a bit of a loaded gun pointed at your foot.)\n\nIf your git-rebase is too old for 'reword', you can use 'edit' instead\nand then, every time that git-rebase drops you into a command line, say\n\n  git commit --amend   # and edit the commit message\n  git rebase --continue\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"182353","messageId":"20120111140513.GA12633@victor","threadId":"29331","inReplyTo":"20120110161843.GC8196@victor","subject":"Re: git svn dcommit sends to wrong branch","fromName":"Victor Engmark","fromEmail":"victor.engmark@terreactive.ch","sentAt":"2012-01-11T14:05:13Z","receivedAt":"2012-01-11T14:05:13Z","isPatch":false,"sender":{"key":"victor.engmark@terreactive.ch","avatar":null},"body":"This message was never delivered and no error message ever came back; is\nthere some weird filtering going on?\n\nOn Tue, Jan 10, 2012 at 05:18:43PM +0100, Victor Engmark wrote:\n> Commands:\n> \n> git svn clone -s -r 1:HEAD http://svn/repo\n> cd repo\n> git commit [thrice, in master only]\n> git rebase --interactive HEAD~20 [i.e., started rebase in commits before\n> the clone]\n> [Merged two commits I had made *after* the clone]\n> git commit ...\n> git dcommit\n> \n> This created commits on\n> <http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's\n> git-svn-id <http://svn/repo/branches/branch_name@22481> is on that\n> branch?\n> \n> And more importantly, how do I \"replay\" my commits on trunk?\n\nCheers,\nV\n-- \nterreActive AG\nKasinostrasse 30\nCH-5001 Aarau\nTel: +41 62 834 00 55\nFax: +41 62 823 93 56\nwww.terreactive.ch\n\nWir sichern Ihren Erfolg - seit 15 Jahren\n"},{"id":"182354","messageId":"877h0yz269.fsf@thomas.inf.ethz.ch","threadId":"29331","inReplyTo":"20120111140513.GA12633@victor","subject":"Re: git svn dcommit sends to wrong branch","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-01-11T15:31:10Z","receivedAt":"2012-01-11T15:31:10Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Victor Engmark <victor.engmark@terreactive.ch> writes:\n\n> This message was never delivered and no error message ever came back; is\n> there some weird filtering going on?\n\nIt was delivered, see e.g.\n\n  http://thread.gmane.org/gmane.comp.version-control.git/188265\n\nHowever, my reply ended up not having a Cc to you because your\nMail-Followup-To header fooled Gnus into believing you didn't want that\nto happen.  Please do not set this header; we Cc everyone involved in\ndiscussions so far, and MFT makes it that much less convenient to\nachieve that.\n\nSince you are apparently not subscribed (otherwise you should have\nreceived my reply), please find a cut&paste of the original reply below.\n\n---- 8< ----\nVictor Engmark <victor.engmark@terreactive.ch> writes:\n\n> Commands:\n>\n> git svn clone -s -r 1:HEAD http://svn/repo\n> cd repo\n> git commit [thrice, in master only]\n\nWhich git version is this?  Before 1.6.5 (b186a261 to be precise)\ngit-svn pointed master at the branch where the last commit in SVN\nhappened, which is not necessarily trunk.  After that it tries to point\nit at trunk instead.  You can find out, e.g., by saying 'git show' on\nthe fresh clone and looking at the git-svn-id line.\n\n> git rebase --interactive HEAD~20 [i.e., started rebase in commits before\n> the clone]\n> [Merged two commits I had made *after* the clone]\n> git commit ...\n> git dcommit\n>\n> This created commits on\n> <http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's\n> git-svn-id <http://svn/repo/branches/branch_name@22481> is on that\n> branch?\n\nThe rule is that the commits go to the branch named in the git-svn-id\nline of the most recent first-parent ancestor of HEAD.\n\nYou can find the \"base\" commit in question with\n\n  git log -1 --first-parent --grep=^git-svn-id:\n\n> And more importantly, how do I \"replay\" my commits on trunk?\n\nYou need to rebase the commits on trunk, and (very important) strip the\ngit-svn-id lines from their messages.  If you only had a handful of\ncommits, your best bet is to use something like\n\n  git checkout -b newbranch\n  git rebase -i --onto svn/trunk svn/branch_name  # or whatever git-svn named the remote branches\n  # edit all the 'pick' into 'reword'\n  # in every commit message editor that pops up, remove the git-svn-id line\n\n  gitk  # make sure that you like the resulting history!\n  git svn dcommit\n\n(If you have many commits, git-filter-branch can do the removal\nautomatically, but it's a bit of a loaded gun pointed at your foot.)\n\nIf your git-rebase is too old for 'reword', you can use 'edit' instead\nand then, every time that git-rebase drops you into a command line, say\n\n  git commit --amend   # and edit the commit message\n  git rebase --continue\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"183120","messageId":"1327591658546-7227251.post@n2.nabble.com","threadId":"29331","inReplyTo":"877h0yz269.fsf@thomas.inf.ethz.ch","subject":"Re: git svn dcommit sends to wrong branch","fromName":"badgerhardy","fromEmail":"andrew.hardy@gl-group.com","sentAt":"2012-01-26T15:27:38Z","receivedAt":"2012-01-26T15:27:38Z","isPatch":false,"sender":{"key":"andrew.hardy@gl-group.com","avatar":null},"body":"\nThomas Rast wrote\n> \n> Victor Engmark &lt;victor.engmark@&gt; writes:\n> \n> The rule is that the commits go to the branch named in the git-svn-id\n> line of the most recent first-parent ancestor of HEAD.\n> \n> You can find the \"base\" commit in question with\n> \n>   git log -1 --first-parent --grep=^git-svn-id:\n> \n>> And more importantly, how do I \"replay\" my commits on trunk?\n> \n> You need to rebase the commits on trunk, and (very important) strip the\n> git-svn-id lines from their messages.  If you only had a handful of\n> commits, your best bet is to use something like\n> \n>   git checkout -b newbranch\n>   git rebase -i --onto svn/trunk svn/branch_name  # or whatever git-svn\n> named the remote branches\n>   # edit all the 'pick' into 'reword'\n>   # in every commit message editor that pops up, remove the git-svn-id\n> line\n> \n>   gitk  # make sure that you like the resulting history!\n>   git svn dcommit\n> \n\nI had the same problem and have followed these instructions (thanks!). I now\nhave a 'newbranch' that will correctly dcommit to the svn trunk. What\nhappens to the git 'master'? Is this recoverable or do I need to delete it\nand rename the 'newbranch' as master?\n\nThanks,\n\n--\nView this message in context: http://git.661346.n2.nabble.com/git-svn-dcommit-sends-to-wrong-branch-tp7172744p7227251.html\nSent from the git mailing list archive at Nabble.com.\n"}]}