Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: Easy way to see changes from last commit

Tags:

mercurial

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.

like image 295
claasz Avatar asked Dec 17 '12 13:12

claasz


People also ask

How do I revert last commit in Mercurial?

If you want to revert just the latest commit use: hg strip --keep -r . Using strip will revert the state of your files to the specified commit but you will have them as pending changes, so you can apply them together with your file to a new commit.

What is HG amend?

hg amend [OPTION]... [ FILE]... aliases: refresh. combine a changeset with updates and replace it with a new one. Commits a new changeset incorporating both the changes to the given files and all the changes from the current parent changeset into the repository.

How do I revert a commit in TortoiseHg?

In the TortoiseHg client's Commit dialog, right-click the needed file and then click Revert.


1 Answers

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.

like image 130
Macke Avatar answered Nov 08 '22 00:11

Macke