Last Updated: February 25, 2016
·
12.33K
· rosatimatteo

How to manage branches with git-svn

first of all, create a new branch on remote svn repository

git svn branch -m "commit message for new branch" branch_name

now check out on git the new tracking branch

git checkout -b local/branch_name branch_name

verify that your changes will be pushed on the right branch on svn running a dry-run dcommit like this

git svn dcommit -n

you should see something like this

mrosati@Rosati ~/Desktop/wcgit (local/adv) % git svn dcommit -n
Committing to file:///Users/mrosati/Desktop/reposvn/branches/new_branch ...

work on your new branch until you are done with your new feature. Next step is merging the new branch into master branch. to do this, first checkout the master branch

git svn checkout master

now do a "squash merge", this will merge the two branches and will let your commit the merged files, if no conflicts are detected

git merge --squash local/new_branch

you are done, commit and push to trunk

git commit -am "merge new_branch branch features"
git svn dcommit