Search code examples
mercurial

Mercurial: Easy way to see changes from last commit


In Mercurial, I can see my current (uncommitted) changes by running

$ hg diff

Fine. But after commit, I sometimes want to see this diff again (i.e., the diff of the last changeset). I know I can achieve this by

$ hg log -l 1
changeset:    1234
tag ...

$ hg diff -c 1234

I'm looking for a way to do this in one line.


Solution

  • Use hg diff -c tip, or hg tip -p (shorter, but works only for tip).

    This will work until you pull something, since tip is an alias for the most recent revision to appear in the repo, either by local commit or pull/push from remote repositories.