Git development
 help / color / mirror / Atom feed
* Using git to perform merges between SVN branches
@ 2008-05-21 15:50 davetron5000
  2008-05-21 18:01 ` Björn Steinbrink
  0 siblings, 1 reply; 2+ messages in thread
From: davetron5000 @ 2008-05-21 15:50 UTC (permalink / raw)
  To: git

Working out of an SVN/subversion repository.  Initially cloned it so I
could work with git via git-svn.  I was given a branch in svn to work
on.  Created local branches connected to the main trunk and my branch
via:

git-checkout -b local-trunk trunk
git branch local-foo FOO

where svn_root/branches/FOO is where I'm to commit changes

commits work fine, etc.

What I'd like to do, for simplicity, and as a demonstration of git's
superior merging, is to do the merge of my code to the main trunk
using git.  My main concern is not getting into a situation where I
cannot commit to svn (since it doesn't track merges)

Would something like this work:

git checkout local-trunk
git-svn rebase
git checkout -b merge-foo local-trunk
git merge local-foo
# Resolve conflicts, etc.  local-foo now has what should go onto SVN's
trunk
git checkout local-trunk
git merge merge-foo
# this should work without any conflicts, since I resolved them on
merge-foo
git-svn dcommit
# Now I've merged my changes to the main trunk

Thanks,

Dave

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

* Re: Using git to perform merges between SVN branches
  2008-05-21 15:50 Using git to perform merges between SVN branches davetron5000
@ 2008-05-21 18:01 ` Björn Steinbrink
  0 siblings, 0 replies; 2+ messages in thread
From: Björn Steinbrink @ 2008-05-21 18:01 UTC (permalink / raw)
  To: davetron5000; +Cc: git

On 2008.05.21 08:50:33 -0700, davetron5000 wrote:
> Working out of an SVN/subversion repository.  Initially cloned it so I
> could work with git via git-svn.  I was given a branch in svn to work
> on.  Created local branches connected to the main trunk and my branch
> via:
> 
> git-checkout -b local-trunk trunk
> git branch local-foo FOO
> 
> where svn_root/branches/FOO is where I'm to commit changes
> 
> commits work fine, etc.
> 
> What I'd like to do, for simplicity, and as a demonstration of git's
> superior merging, is to do the merge of my code to the main trunk
> using git.  My main concern is not getting into a situation where I
> cannot commit to svn (since it doesn't track merges)
> 
> Would something like this work:
> 
> git checkout local-trunk
> git-svn rebase
> git checkout -b merge-foo local-trunk
> git merge local-foo
> # Resolve conflicts, etc.  local-foo now has what should go onto SVN's
> trunk
> git checkout local-trunk
> git merge merge-foo
> # this should work without any conflicts, since I resolved them on
> merge-foo
> git-svn dcommit
> # Now I've merged my changes to the main trunk

You can skip the whole merge-foo thing and just merge local-foo into
local-trunk, the second merge would end-up as a fast-forward anyway.

That said, the above should work, given that a) you don't do any
rebasing after merging and b) the merge commit is the first commit that
gets dcommitted to svn.

I don't remember what happens when there are new revisions in svn since
you last ran "git svn rebase", so you might want to try that case on a
throw-away svn repo first.

What SVN will see is basically what git would see had you done a "merge
--squash", but git will retain the merge information (big plus!).

Björn

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

end of thread, other threads:[~2008-05-21 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 15:50 Using git to perform merges between SVN branches davetron5000
2008-05-21 18:01 ` Björn Steinbrink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox