Difference between Revert and Update in Mercurial

I’m just getting started with Mercurial, and I’ve come across something which I don’t understand.

I made changes to several files, and now I want to undo all the changes I made to one of them (i.e. go back to my last commit for one specific file).

  • How do I print the list of changeset hashes on a given branch, in Mercurial?
  • How do I “reopen” a git commit?
  • Merges between two branches in two directions - any good reason or completely forbid?
  • Mercurial internals : Git subrepository status after aggressive permission change
  • Dealing with glade files in DVCs
  • Steps needed to allow hgsubversion SVN clone to push back
  • As far as I can see, the command I want is revert.

    In the page I linked to, there is the following statement:

    This operation however does not change
    the parent revision of the working
    directory (or revisions in case of an
    uncommitted merge). To undo an
    uncomitted merge, you can use “hg
    update -C -r.” which will reset the
    parents to the first parent.

    I don’t understand the difference between the two (hg revert vs. hg update -C -r). Can anyone enlighten me as to the difference? And in my case, do I really want the revert or the update to go get rid of the changes I made to the file?


  • Setting Git for a team of 3 people?
  • git push to specific branch
  • Some code was lost after doing bzr commit --local, bzr pull, bzr commit
  • Transitioning git repos to submodules inside git-annex?
  • svn externals … yes or no?
  • Take arbitrary git working copy and make exactly the same as remote branch
  • One Solution collect form web for “Difference between Revert and Update in Mercurial”

    The first difference is revert can work on a subset of the working copy while update works on the whole working copy. the other difference is in what happens when you want to go back to a version other than the last committed one.

    if we have revisions (caps are committed, lower case are changes in the working copy, parent revision is C )


    update -C -r B will give you


    with your working copy set to B, any changes will result in branching from B (parent revision set to B)


    revert -r B will give you


    where b’ is a set of changes which undoes everything in the intermediate committed changes, in this case it undoes all of C. any changes now just join the b’ set (parent revision left unchanged at C)

    Git Baby is a git and github fan, let's start git clone.