How to overwrite a specific file from a branch to a trunk in SVN?
How can I overwrite a file from a specific b开发者_Go百科ranch 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.
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
Execute following command from trunk's working copy:
svn merge --accept theirs-full https://web/branches/tt_branch/text.cpp
I think the accepted answer is a lot better than the one I'm about to give, but svn cat can be useful in some situations where you don't want to mess with merging and don't want to clobber your commit history.
svn cat https://web/branches/tt_branch/text.cpp > text.cpp
精彩评论