问题
If I view the Subversion log in TortoiseSVN
When I select a revision and right-click, I see the following options (among others):
- Update item to revision
- Revert to this revision
- Revert changes from this revision
Can someone explain what are the differences between these 3?
What I actually want to do is temporarily revert my working copy back to the selected version of the repository. Which of these options should I choose?
回答1:
You should choose the second option.
Here's what you get when you click on the Help button in this dialog:
Update item to revision
Update your working copy to the selected revision. Useful if you want to have your working copy reflect a time in the past, or if there have been further commits to the repository and you want to update your working copy one step at a time. It is best to update a whole directory in your working copy, not just one file, otherwise your working copy could be inconsistent.
If you want to undo an earlier change permanently, use Revert to this revision instead.
Revert to this revision
Revert to an earlier revision. If you have made several changes, and then decide that you really want to go back to how things were in revision N, this is the command you need. The changes are undone in your working copy so this operation does not affect the repository until you commit the changes. Note that this will undo all changes made after the selected revision, replacing the file/folder with the earlier version.
If your working copy is in an unmodified state, after you perform this action your working copy will show as modified. If you already have local changes, this command will merge the undo changes into your working copy.
What is happening internally is that Subversion performs a reverse merge of all the changes made after the selected revision, undoing the effect of those previous commits.
If after performing this action you decide that you want to undo the undo and get your working copy back to its previous unmodified state, you should use TortoiseSVN → Revert from within Windows Explorer, which will discard the local modifications made by this reverse merge action.
If you simply want to see what a file or folder looked like at an earlier revision, use Update to revision or Save revision as... instead.
Revert changes from this revision
Undo changes from which were made in the selected revision. The changes are undone in your working copy so this operation does not affect the repository at all! Note that this will undo the changes made in that revision only; it does not replace your working copy with the entire file at the earlier revision. This is very useful for undoing an earlier change when other unrelated changes have been made since.
If your working copy is in an unmodified state, after you perform this action your working copy will show as modified. If you already have local changes, this command will merge the undo changes into your working copy.
What is happening internally is that Subversion performs a reverse merge of that one revision, undoing its effect from a previous commit.
You can undo the undo as described above in Revert to this revision.
来源:https://stackoverflow.com/questions/7729118/reverting-with-tortoise-svn