Merge SVN Branches
(Redirected from Developers Guide:Merging Branches)
Jump to navigation
Jump to search
Merging Branches in SVN
The following steps can help you with merging branches in SVN. You must have the branch you are merging into checked out on your local filesystem.
This example shows how to merging changes from the main trunk into the 4.2 branch. Commands shown are from the SVN command line client:
- Update your local copy of the 4.2 branch (svn update)
- Find out the last time the branch was merged by looking through the svn log (svn log --limit 5) The result of running the log command would look something like this:
C:\PhpGedView\workspace\pgv-4.2>svn log --limit 5 ------------------------------------------------------------------------ r1341 | yalnifj | 2007-07-26 08:40:10 -0600 (Thu, 26 Jul 2007) | 1 line Merging with main trunk ------------------------------------------------------------------------ r1340 | windmillway | 2007-07-25 23:23:52 -0600 (Wed, 25 Jul 2007) | 2 lines Aesthetic enhancements for Lightbox Album and Googlemaps themes (Thanks mainly to Nigel Osborne) ------------------------------------------------------------------------
- Run the SVN merge command: (C:\PhpGedView\workspace\pgv-4.2>svn merge -x -w -r 1341:HEAD https://phpgedview.svn.sourceforge.net/svnroot/phpgedview/trunk/phpGedView)
- In this command the -r option specifies the revisions to merge. So in this example we want to merge 4.2 revision 1341 with the HEAD revision of the main trunk.
- The result should look something like this:
U includes\index_cache.php C includes\menu.php U includes\functions_privacy.php U includes\functions_edit.php U includes\class_stats.php U includes\session.php U includes\functions_print.php U includes\functions_rss.php U includes\functions.php
- Now for the tricky part, Resolving any conflicts. From the example above you can see that the "includes\menu.php" file has conflicted. You will need to open the file and find the conflicts (delimited by <<<< ==== >>>> signs) and figure out how to best fix the conflict.
- When you have removed all of the conflicts and saved the file, mark the conflicts as resolved (svn resolved includes\menu.php)
- Commit the new files to the 4.2 branch (svn commit)