git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git svn dcommit sends to wrong branch
@ 2012-01-10 16:18 Victor Engmark
  2012-01-10 19:43 ` Thomas Rast
  2012-01-11 14:05 ` Victor Engmark
  0 siblings, 2 replies; 5+ messages in thread
From: Victor Engmark @ 2012-01-10 16:18 UTC (permalink / raw)
  To: git

Commands:

git svn clone -s -r 1:HEAD http://svn/repo
cd repo
git commit [thrice, in master only]
git rebase --interactive HEAD~20 [i.e., started rebase in commits before
the clone]
[Merged two commits I had made *after* the clone]
git commit ...
git dcommit

This created commits on
<http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's
git-svn-id <http://svn/repo/branches/branch_name@22481> is on that
branch?

And more importantly, how do I "replay" my commits on trunk?

-- 
terreActive AG
Kasinostrasse 30
CH-5001 Aarau
Tel: +41 62 834 00 55
Fax: +41 62 823 93 56
www.terreactive.ch

Wir sichern Ihren Erfolg - seit 15 Jahren

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git svn dcommit sends to wrong branch
  2012-01-10 16:18 git svn dcommit sends to wrong branch Victor Engmark
@ 2012-01-10 19:43 ` Thomas Rast
  2012-01-11 14:05 ` Victor Engmark
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Rast @ 2012-01-10 19:43 UTC (permalink / raw)
  To: git

Victor Engmark <victor.engmark@terreactive.ch> writes:

> Commands:
>
> git svn clone -s -r 1:HEAD http://svn/repo
> cd repo
> git commit [thrice, in master only]

Which git version is this?  Before 1.6.5 (b186a261 to be precise)
git-svn pointed master at the branch where the last commit in SVN
happened, which is not necessarily trunk.  After that it tries to point
it at trunk instead.  You can find out, e.g., by saying 'git show' on
the fresh clone and looking at the git-svn-id line.

> git rebase --interactive HEAD~20 [i.e., started rebase in commits before
> the clone]
> [Merged two commits I had made *after* the clone]
> git commit ...
> git dcommit
>
> This created commits on
> <http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's
> git-svn-id <http://svn/repo/branches/branch_name@22481> is on that
> branch?

The rule is that the commits go to the branch named in the git-svn-id
line of the most recent first-parent ancestor of HEAD.

You can find the "base" commit in question with

  git log -1 --first-parent --grep=^git-svn-id:

> And more importantly, how do I "replay" my commits on trunk?

You need to rebase the commits on trunk, and (very important) strip the
git-svn-id lines from their messages.  If you only had a handful of
commits, your best bet is to use something like

  git checkout -b newbranch
  git rebase -i --onto svn/trunk svn/branch_name  # or whatever git-svn named the remote branches
  # edit all the 'pick' into 'reword'
  # in every commit message editor that pops up, remove the git-svn-id line

  gitk  # make sure that you like the resulting history!
  git svn dcommit

(If you have many commits, git-filter-branch can do the removal
automatically, but it's a bit of a loaded gun pointed at your foot.)

If your git-rebase is too old for 'reword', you can use 'edit' instead
and then, every time that git-rebase drops you into a command line, say

  git commit --amend   # and edit the commit message
  git rebase --continue

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git svn dcommit sends to wrong branch
  2012-01-10 16:18 git svn dcommit sends to wrong branch Victor Engmark
  2012-01-10 19:43 ` Thomas Rast
@ 2012-01-11 14:05 ` Victor Engmark
  2012-01-11 15:31   ` Thomas Rast
  1 sibling, 1 reply; 5+ messages in thread
From: Victor Engmark @ 2012-01-11 14:05 UTC (permalink / raw)
  To: git

This message was never delivered and no error message ever came back; is
there some weird filtering going on?

On Tue, Jan 10, 2012 at 05:18:43PM +0100, Victor Engmark wrote:
> Commands:
> 
> git svn clone -s -r 1:HEAD http://svn/repo
> cd repo
> git commit [thrice, in master only]
> git rebase --interactive HEAD~20 [i.e., started rebase in commits before
> the clone]
> [Merged two commits I had made *after* the clone]
> git commit ...
> git dcommit
> 
> This created commits on
> <http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's
> git-svn-id <http://svn/repo/branches/branch_name@22481> is on that
> branch?
> 
> And more importantly, how do I "replay" my commits on trunk?

Cheers,
V
-- 
terreActive AG
Kasinostrasse 30
CH-5001 Aarau
Tel: +41 62 834 00 55
Fax: +41 62 823 93 56
www.terreactive.ch

Wir sichern Ihren Erfolg - seit 15 Jahren

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git svn dcommit sends to wrong branch
  2012-01-11 14:05 ` Victor Engmark
@ 2012-01-11 15:31   ` Thomas Rast
  2012-01-26 15:27     ` badgerhardy
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Rast @ 2012-01-11 15:31 UTC (permalink / raw)
  To: git; +Cc: Victor Engmark

Victor Engmark <victor.engmark@terreactive.ch> writes:

> This message was never delivered and no error message ever came back; is
> there some weird filtering going on?

It was delivered, see e.g.

  http://thread.gmane.org/gmane.comp.version-control.git/188265

However, my reply ended up not having a Cc to you because your
Mail-Followup-To header fooled Gnus into believing you didn't want that
to happen.  Please do not set this header; we Cc everyone involved in
discussions so far, and MFT makes it that much less convenient to
achieve that.

Since you are apparently not subscribed (otherwise you should have
received my reply), please find a cut&paste of the original reply below.

---- 8< ----
Victor Engmark <victor.engmark@terreactive.ch> writes:

> Commands:
>
> git svn clone -s -r 1:HEAD http://svn/repo
> cd repo
> git commit [thrice, in master only]

Which git version is this?  Before 1.6.5 (b186a261 to be precise)
git-svn pointed master at the branch where the last commit in SVN
happened, which is not necessarily trunk.  After that it tries to point
it at trunk instead.  You can find out, e.g., by saying 'git show' on
the fresh clone and looking at the git-svn-id line.

> git rebase --interactive HEAD~20 [i.e., started rebase in commits before
> the clone]
> [Merged two commits I had made *after* the clone]
> git commit ...
> git dcommit
>
> This created commits on
> <http://svn/repo/branches/branch_name>! Why? Is it because HEAD~20's
> git-svn-id <http://svn/repo/branches/branch_name@22481> is on that
> branch?

The rule is that the commits go to the branch named in the git-svn-id
line of the most recent first-parent ancestor of HEAD.

You can find the "base" commit in question with

  git log -1 --first-parent --grep=^git-svn-id:

> And more importantly, how do I "replay" my commits on trunk?

You need to rebase the commits on trunk, and (very important) strip the
git-svn-id lines from their messages.  If you only had a handful of
commits, your best bet is to use something like

  git checkout -b newbranch
  git rebase -i --onto svn/trunk svn/branch_name  # or whatever git-svn named the remote branches
  # edit all the 'pick' into 'reword'
  # in every commit message editor that pops up, remove the git-svn-id line

  gitk  # make sure that you like the resulting history!
  git svn dcommit

(If you have many commits, git-filter-branch can do the removal
automatically, but it's a bit of a loaded gun pointed at your foot.)

If your git-rebase is too old for 'reword', you can use 'edit' instead
and then, every time that git-rebase drops you into a command line, say

  git commit --amend   # and edit the commit message
  git rebase --continue

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git svn dcommit sends to wrong branch
  2012-01-11 15:31   ` Thomas Rast
@ 2012-01-26 15:27     ` badgerhardy
  0 siblings, 0 replies; 5+ messages in thread
From: badgerhardy @ 2012-01-26 15:27 UTC (permalink / raw)
  To: git


Thomas Rast wrote
> 
> Victor Engmark &lt;victor.engmark@&gt; writes:
> 
> The rule is that the commits go to the branch named in the git-svn-id
> line of the most recent first-parent ancestor of HEAD.
> 
> You can find the "base" commit in question with
> 
>   git log -1 --first-parent --grep=^git-svn-id:
> 
>> And more importantly, how do I "replay" my commits on trunk?
> 
> You need to rebase the commits on trunk, and (very important) strip the
> git-svn-id lines from their messages.  If you only had a handful of
> commits, your best bet is to use something like
> 
>   git checkout -b newbranch
>   git rebase -i --onto svn/trunk svn/branch_name  # or whatever git-svn
> named the remote branches
>   # edit all the 'pick' into 'reword'
>   # in every commit message editor that pops up, remove the git-svn-id
> line
> 
>   gitk  # make sure that you like the resulting history!
>   git svn dcommit
> 

I had the same problem and have followed these instructions (thanks!). I now
have a 'newbranch' that will correctly dcommit to the svn trunk. What
happens to the git 'master'? Is this recoverable or do I need to delete it
and rename the 'newbranch' as master?

Thanks,

--
View this message in context: http://git.661346.n2.nabble.com/git-svn-dcommit-sends-to-wrong-branch-tp7172744p7227251.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-26 15:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-10 16:18 git svn dcommit sends to wrong branch Victor Engmark
2012-01-10 19:43 ` Thomas Rast
2012-01-11 14:05 ` Victor Engmark
2012-01-11 15:31   ` Thomas Rast
2012-01-26 15:27     ` badgerhardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).