SVN Merge Changes From Branch into Trunk using Reintegration

If you’re like me, when using subversion, you have a trunk, and then you create branches for code fixes and enhancements.

But if you’re like me, you already know how to do this and so reading this is a waste of your time. But if you’re REALLY like me, you don’t remember all of these bits and pieces and you need to write it down. This is me writing it down.

Let’s pretend you have a branch located in that is all tested and ready to merge into the trunk, here’s how I would do it.

Grab a fresh checkout of JIRA-03923

svn co

That creates a directory JIRA-03923.

cd JIRA-03923

Now I merge all of the changes that have happened in trunk into the branch.

svn merge

Commit those changes to the branch.

svn commit -m "Merged changes from trunk to this branch."

Now I grab a fresh checkout of the trunk.

cd ..
svn co

This creates a “trunk” directory. If you want to create a different directory provide one as a parameter like svn co JunkInMyTrunk. That puts all that junk your trunk.

cd trunk

Now reintegrate the changes from the branch to trunk.

svn merge --reintegrate

Commit those changes to the trunk.

svn commit -m "Merged all changes from JIRA-03923 branch into trunk"

That branch is now useless and I remove it.

svn delete -m "Removing unnecessary branch"
Share Button