How to synchronize remote branches with trunk using git-svn

I am using git-svn to work with the svn repository. The layout is standard, and I created a local repository with:

$ git svn clone -s http://mysvnrepo (master)$ 

I need to work with a remote branch (svn) - MyBranch, so I created a local branch to track the remote:

 (master)$ git checkout -b localMyBranch remotes/MyBranch (localMyBranch)$ 

I keep working and committing to the local branch when I go, and sometimes I do dcommit:

 (localMyBranch)$ git svn dcommit 

Meanwhile, other people are working on the trunk, and from time to time I want to merge the changes from the trunk to my branch in order to synchronize them. That I really got confused, because I could not find good information on how to do this. So far I know what I need to do:

 (localMyBranch)$ git svn dcommit (localMyBranch)$ git checkout master (master)$ git svn rebase 

Now what? I read that this is NOT the right way:

 (master)$ git checkout localMyBranch (localMyBranch)$ git rebase master 

How is he going to ruin the merge information for svn.

So, what is the best way to β€œreinstall” my remote svn branch to a remote trunk while saving merge information for svn?

+7
source share
1 answer

You want to create a local working branch to handle your merge. The key is that you need a branch that does not actively track the remote svn branch.

Try the following:

 (localMyBranch)$ git checkout -b merge_work (merge_work)$ git merge master (merge_work)$ git checkout localMyBranch (localMyBranch)$ git rebase merge_work 

and vice versa to merge with another way.

EDIT

If you are using git-svn 1.7.7 or later, there is a configuration parameter to tell git-svn to populate the mergeinfo property in the remote repository:

 git config --global svn.pushmergeinfo true 
+7
source

All Articles