revert vs. update for uncommited changes
Suppose you have commit some changes, and then somehow deleted/modified some files by accident.
Which开发者_如何转开发 would be better? Using revert
oder update
?
There are two big differences between running hg update -C and doing hg revert -a
- Update will move your parent up to the tip of the head of the branch
- Update will no create any backup files
The revert command on the other hand
- Creates backups of all reverted files (unless you give --no-backup command)
- Does not change your working directories parent changeset.
Now which is better? Depends in which of the things listed above you want.
In your case you want revert
-- it alters your working directory without altering the output of the hg parents
command. Your parent revision
is the "currently checked out revision" and will become the "parent" of your next commit. You don't need to alter that pointer, so just revert
.
精彩评论