So you are working on this humongous project and its that time when everyone in the team
has to start working on different modules or functionalities. The way to proceed is to create
module branches and start working on it.
Sooner than you may think, you would be required to merge all those branches into the trunk
once you have your module complete and tested.
Enough of background, lets go ahead and merge those branches..
Your svn trunk directory:
http://svnprojects.com/myapp/trunk
Your svn branch directory:
http://svnprojects.com/myapp/branches/mybranch
So we start with the trunk
svn co http://svnprojects.com/myapp/trunk
To create a branch from trunk we use svn cp
svn cp http://svnprojects.com/myapp/trunk http://svnprojects.com/myapp/branches/mybranch
Simultaneously we work on the branch as well
svn co http://svnprojects.com/myapp/branches/mybranch
Now when we need to merge the branch into the trunk,we first check the revision
at which the branch got created.We do that as following:
svn log --stop-on-copy
Keep a note of the revision number where the branch got created.Lets call it rev AAAA
Now switch the working directory of the branch to trunk using
svn switch http://svnprojects.com/myapp/trunk
Post switch, update your directory
svn up
Keep a note of revision it gets updated to. Lets call it rev BBBB
Now the important task of merging the branch.
svn merge -rAAAA:BBBB http://svnprojects.com/myapp/branches/mybranch
Resolve the conflicts and commit ..
svn ci -m 'Merged branch mybranch into trunk'
Voila! We are done! Happy Merging!!!