Quick SVN Merge Guide via Linux Command Line

Abhishek Jain
Tech Insider
Published in
2 min readJan 18, 2018

*reintegration merge*- A reintegration merge, also known as a back merge is appropriate when the changes made in a branch need to be integrated back into the branch’s ancestor

svn merge — Apply the differences between two sources to a working copy path

We will be Merging a branch back into the trunk and assuming branch is also not up to date.

1) first of all we will be updating our branch from Trunk

so that when we merge we do not face any conflicts.

(first resolve conflict then merge mechanism)

(navigate to svn directory of your branch in a terminal window and run following commands)

As you have already committed the final useful code to that branch so let’s run

>> svn update

let’s revert garbage code (auto generated by compilers )(for eg in android project studio modifies some .iml and .gradle files)

>> svn revert -R .

>>svn merge <URL OF TRUNK>

Now you will be seeing conflicts, if any (solve all these conflicts )

(manually go to those files one by one ,resolve conflicts) enter “s” to show all options ,then Enter “e” in terminal to edit ,close that edit session (as you have already edited by visiting manually) ,Enter “r” to say conflict resolved and move to next.

do same for all those conflicts (if anything is fully changed ,take your side of changes or their side,whatever needs to be done)

>> svn commit -m “meaningful message about changes”

all the changes will be committed to your branch

2.)Now Reintegrating it back to trunk

Navigate to Trunk checkout folder in terminal ,then run

>> svn update

>>svn revert -R .

— Now reintegration part (changes made in a branch to be integrated back into the TRUNK)

svn merge — reintegrate <Branch url>

now,

>>svn commit -m “message”

*yayayyaayyayayayyayaayyy* finally it’s done .

{you will not be getting merge conflict as we have already resolved them in our branch}

--

--

Abhishek Jain
Tech Insider

Android dev | Software developer at InMobi, Ex- MMT, Tokopedia