Monthly Archives: June 2011

SVN how to merge branch into trunk

After I messed up a svn repo because of a wrong merge I started to read svn book and how to properly merge a branch into trunk.

Let’s assume you have a branch called my-branch.

1. Go into branch folder (/var/www/my-branch)

To be sure you are in the branch folder just type svn info. You should see: URL: svn://svn.example.com/project/branches/my-branch

2. Commit or revert everything to have a clean copy and update: svn up

3. Bring the last changes from trunk into your branch

see changes and test

4. If everything is fine, commit those changes into your branch

If something went wrong you can revert with svn revert . -R

5. Go into trunk folder (you should also have a trunk clone)

6. Update your trunk copy:

7. Most important. Bring changes from BRANCH to TRUNK.

8.

to see changes and test

9. Finally, commit your branch changes to trunk

Now, you can delete the old branch: