What is the name for the commit/head that corresponds to the local checked-out state?

Viewed 52

There is a commit in my hg repository with hash 123abc. This is the last commit I made in the repo. When I run hg diff --from 123abc, I see no output. When I run hg log --graph, I see an @ next to 123abc.

In Git this commit would be called "HEAD". I'm not sure what it's called in Mercurial. It is not the "tip", because I pulled other changes after the last time I committed (and hg log -r tip shows commit 456def).

What is this commit/head called?

2 Answers

Mercurial calls this the "parent" or the "parent revision of the working directory", and you can see it by running hg parent, hg id, or hg summary.

You can refer to it as . with the hg log command:

hg log -r .  # show the commit message for the parent

If 123abc has no children, then it is a "head".

A head is a changeset with no child changesets. The tip is the most recently changed head. Other heads are recent pulls into a repository that have not yet been merged.

(https://www.mercurial-scm.org/wiki/Head)


Regardless whether the current working directory derives from a head or a non-head, I would refer to the commit that precedes it as the "working directory parent" changeset or commit. (That may just be the term my team uses - not sure it is "official".)

The parent may be visible in a GUI tool (like Tortoise) or you can get it using hg parent.


Based on the statements about 456def I'm a little confused whether it has no children, or not? (Maybe update the question to clarify / add more detail)

Related