SVN Merge using Tortoise svn OR command line

Before you start you should find the revision number in the source folder you want to merge forward from.

Steps:
  1. ensure all is committed and its updated in target folder
  2. go to target folder (you want to merge into) and right click and choose Merge
  3. on screen 1, I usually choose "Merge range of revisions"  and click Next. But if you want to merge from a Branch then select the Merge from Branch 2nd option and then on next screen choose the Branch URL to merge from. 
  4. on screen 2 "Merge Revision Range", choose url to merge from (i.e. source)
  5. on screen 2, enter revision range to merge e.g. 1230-Head.   This means merge revision 1230s to Head from the source to the target you selected in step 2 i.e. a range. You could also just merge a single revision number or more than one delimited by commas. You can click Show Log button to see a list of revision to choose from.
  6. click Next
  7. on screen 3 "Merge Options", you can click Test Merge to see what a merge would do. This shows the effects of a merge (changes/conflicts) but does not change local copies. This is really useful and I usually run a test merge. You can also do a test merge when merging from a branch.
  8. on screen 3 click Merge button to have svn do the merge
  9. resolve any conflicts; when resolved you can choose tortoise svn Accept to indicate its merged and then can commit it (that will delete the any temporary files created by conflict)
  10. when all is good then commit; adding comments for each merge is a good way to keep track of the last revision merged.

If there are Merge issues Tortoise displays the merge conflict tool which allows you to choose local copy, choose source copy or Edit to resolve manually.

Note: I have seen some merge conflicts raised which are not real conflicts upon deeper inspection. For svn Tree Conflicts I figured out what was correct and then tortoise svn Accepted it.

The svn automatic merge is pretty good, once done you then commit. I've also used a tool like BeyondCompare to do merges especially in the case of conflicts highlighted by a test merge. Svn adds the highlights like cvs does and that makes it a bit of a pain when there's conflicts. But at least u clearly know what's conflicted!



Merging on mac
No more Tortoise Svn since I moved to the mac
I had recourse to work on svn merge fromone branch to another. Last time I did it I used svn cherry pick (svn merge -c revNo ...) since I only had a few changes but this time I had to do more of a classic merge:
1. merge from target to my branch
2. resolve conflicts and test
3. commit
4. then merge from my branch to target
5. resolve and test

When merging from branch to branch I first ran svn merge with --dry-run option to test the merge. Then I ran the merge proper. There were a number of conflicts.
You can see diff conflicts using "dc" and try to merge using svn tools but I need something more visual so I downloaded free diff tool "DiffMerge" to help visually view diffs on my mac and merged changes by hand.
When done I resolve the file using this command:
svn resolve --accept working benCoreAccountActions.class.php

When there is a merge conflict svn creates a .working file which I ensured had the changes I wanted (as well as the original filename)




Comments

Popular posts from this blog

deep dive into Material UI TextField built by mui

angular js protractor e2e cheatsheet

react-router v6.4+ loaders, actions, forms and more