Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overwrite a specific file from a branch to a trunk in SVN?

Tags:

svn

How can I overwrite a file from a specific branch to a trunk?

Like for example I have https://web/trunk/text.cpp file. Then I want my https://web/branches/tt_branch/text.cpp overwrite the trunk file.

like image 458
domlao Avatar asked Sep 06 '11 07:09

domlao


People also ask

What does svn merge do?

This basic syntax— svn merge URL —tells Subversion to merge all changes which have not been previously merged from the URL to the current working directory (which is typically the root of your working copy).

Does svn merge delete the branch?

If you merge a branch into trunk using "svn merge --reintegrate", you are recommended to delete the branch. If you want to do further development in that branch, you should "re-branch", effectively create a new branch with the same name, but rooted at the same revision as you merged the branch into trunk.


1 Answers

If you want to completely overwrite the trunk file with the branched file, you can delete the trunk file and then make a copy of the branch one (easy and radical)

svn delete https://web/trunk/text.cpp -m "delete trunk file"
svn copy https://web/branches/tt_branch/text.cpp

If you want to do something less absolute, try to use the svn merge operation

svn merge https://web/branches/tt_branch/text.cpp https://web/trunk/text.cpp

that will ask you to solve the potential conflicts, if you don't want to resolve any conflicts, try this :

svn merge --accept theirs-full https://web/branches/tt_branch/text.cpp https://web/trunk/text.cpp
like image 154
Cédric Julien Avatar answered Oct 05 '22 06:10

Cédric Julien