开发者

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

  1. Update will move your parent up to the tip of the head of the branch
  2. Update will no create any backup files

The revert command on the other hand

  1. Creates backups of all reverted files (unless you give --no-backup command)
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜