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

svn merge http://svn.example.com/project/trunk

see changes and test

svn status

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

svn ci -m ‘last changes from trunk into 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:

svn up

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

svn merge --reintegrate svn://svn.example.com/project/branches/my-branch

8.

svn st

to see changes and test

9. Finally, commit your branch changes to trunk

svn ci -m “Merge my-branch into trunk”

Now, you can delete the old branch:

svn delete svn://svn.example.com/project/branches/my-branch -m “Remove my-branch”