Usage:
svn merge <source> -r<X>:<Y> <dest>
where X is the revision from where your branch was copied, and Y is the revision you want to merge your branch into. The value of Y is usually the latest revision of trunk, or HEAD.
Switching a branch back to trunk
Note: \ means that the command continues on to the succeeding line/s.
- Get the revision number from when your branch was created.
- Option 1: switch to the branch, and find the revision your branch began at:
svn switch http://examplesvn.com/svn/ \
project/branches/branch_name
svn log --stop-on-copy
This will display the commits that have been made in branch_name back to the point it was created. The oldest revision here will be used as the value of X.
- Option 2: find the revision your branch began at without switching:
svn log --stop-on-copy http://examplesvn.com/ \
svn/project/branches/branch_name
This, too, will behave the same way as option 1.
- Option 1: switch to the branch, and find the revision your branch began at:
- Switch to destination, in this case, trunk.
svn switch http://examplesvn.com/svn/project/trunk
- Test-run the merging.
svn merge http://examplesvn.com/svn/project/ \
branches/branch_name -rX:HEAD . --dry-run
where X is the revision when branch_name was created, and HEAD (the actual string, not a representative of a value) is the latest revision of your current working copy, trunk, which is also your destination set to ".". This command will simulate the actual merging, display the conflicts, if any (this is what you want to watch out for), and the rest of the changes to be made if this was an actual merge.
Note. This is actually a good practice, since you will see what's going to happen upon merging, without the risk of destroying your current working copy.
- Merge. If the dry-run is successful and looks good to you, proceed with merging:
svn merge http://examplesvn.com/svn/project/ \
branches/branch_name -rX:HEAD .
- Check status. Check if the changes are reflected.
svn status
- Commit. If everything is ok - changes are reflected, conflicts have been resolved, etc - commit the current changes by the merge.
svn commit -m "MERGING branches/branch_name to trunk"
And that's it. :)
No comments:
Post a Comment