Using Subversion SVN How To Merge Files From Branch To Trunk

Subversion is an open source versioning tool widely used for managing the code. In my previous subversion post i have written about the basics of SVN.

SVN command to Merge files from branch to trunk

In subversion when you commit files you get the revision number of that commit. Use that revision number to merge the files from your branch to trunk. You can merge files one by one or in bulk. If you are beginner try to merge file one by one once you master you can easily handle it.

For example- I am merging my files from example1 branch to trunk. Before that i have commit one file from example1 whose revision number is 3458.

raj@raj-300E4C-300E5C-300E7C:/var/www/trunk$ svn merge -r3458:3457 ../branches/example1
 --- Merging r3458 into '.':
U    core/example.php

Once the merging is successful you can commit the file with appropriate comment.

 svn commit -m "test file"
Sending        trunk
Sending        trunk/core/example.php
Transmitting file data ..
Committed revision 3461.

After -m switch in double quotes write your comment.

When conflict occurs while merging your files to trunk then it shows message like this

Conflict discovered in 'example1/example.php'.
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options:

Resolved this conflict by checking the df(diff-full) and then switch to edit mode. Resolved the conflict then press ctrl+x to save the changes. After that press r.

To check the log use

 svn log|head

Shows the latest commit log.

admin

About admin

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , . Bookmark the permalink.