Mercurial: Easy way to see changes from last commit

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.


An alternative is to use: hg diff --rev -2:-1

This form has the advantage that it can be used with the status command (e.g. hg st --rev -2:-1), and using it makes it easy to remember what to do when one needs to determine differences between other revision pairs (e.g. hg diff --rev 0:tip).


You can use relative revision numbers for the --change option:

hg diff -c -1

See https://stackoverflow.com/a/3547662/239247 for more info.


The answer from Macke is quite helpful, but in my case I didn't want to diff tip.

Thankfully you can also just diff the currently selected comment:

hg diff -c .

Tags:

Mercurial