views:

495

answers:

3

With SVN, I have the following setup:

/tags/
/trunk/
/branches/
/branches/my_feature
/branches/my_other_feature

I want to keep all the branches in sync with mainline trunk, so I periodically run an svn merge for the branch for trunk.

However, I also want to keep all the branches in sync with one another, so as to avoid conflicts, as any given branch's lifetime can be a couple of months or more. If I have a dozen branches, I would have a nasty mesh with SVN, and it would be impractical.

My question is, would using Git instead of SVN help with keeping branches in sync with one another and trunk?

+2  A: 

Yes, for the most part. All three of the modern DVCSes (Git, Mercurial, and Bazaar) can tell when you last merged and won't try to remerge changesets that have already been merged.

You might run into some weird edge cases if you're doing some really tricky stuff, but even if you do it will be miles better than using SVN.

Steve Losh
+2  A: 

It would help you keep both branches in sync with trunk by doing a rebase.

While using the branch my_feature, execute:

git rebase master

And that will bring your changes in the master (trunk) branch to my_feature.

About keeping my_feature and my_other_feature in sync, its the same principle if one is a descendant of the other. If my_feature is not a descendant of my_other_feature or viceversa, I don't know the answer.

eblacklight
A: 

Note that you should use Git completely instead of SVN to get the desired functionality. If you merely use git as a front-end to SVN (vai git svn), this will likely cause things to not appear correct to SVN users.

davetron5000