How do I drop a file from a branch and go back to the trunk version?
I have an SVN branch that has files with committed modifications on it. We've now decided that some of these modifications are not required.
How do I effectively discard all the changes I'v开发者_运维技巧e made to these files on the branch and get the branch to go back to using the trunk revision of these particular files?
Edit: I should have added that some of the files were new on the branch, but have subsequently been added to trunk by a completely different branch and now I want to use those. I sorted these ones by SVN Deleting them from the branch then using SVN Copy to copy the versions from the trunk - which seems to have worked.
- Right click a file you want to roll back, TortoiseSVN "Show Log"
- Identify the revision you want to roll back to.
- Right click the revision and "Revert to this revision"
- Check that the file is now in the state you want
- Commit
Between step 4 and 5, you can also roll back other files in case you want to commit all rollbacks together.
Instead of reverting entirely to a specific revision, you can also just undo the changes of certain revisions with "Revert changes from this revision". This is useful if some unwanted changes are followed in the history by changes that you want to keep.
This is all covered in the excellent TortoiseSVN documentation, which you can access through the TortoiseSVN "help" item in your windows explorer context menu.
If you want the whole branch to revert to the trunk revision, I'd just create a new branch from trunk, or delete that branch and re-create it from trunk. If it's just some files you want back to trunk state, just svn copy
those files from trunk into the branch.
Edit: You might also want to read The Subversion Book - Undoing Changes for a method of reversing committed changes.
Have you tried deleting the file from the branch, and then merge from trunk? You may have to tell it that "mine conflict" (mc) if prompted.
精彩评论