helpermethod
helpermethod

Reputation: 62244

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?

Upvotes: 6

Views: 3681

Answers (2)

Matthew Manela
Matthew Manela

Reputation: 16762

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.

Upvotes: 9

Ry4an Brase
Ry4an Brase

Reputation: 78350

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.

Upvotes: 2

Related Questions