Reputation: 15033
I’m new to Mercurial. I’m trying to clone the second newest commit from the web interface, and everything I’ve red says I need to enter the revision number. However, the web interface only shows “age”, “author”, “description” and at the bottom has “rev 27: (0) tip”
I know which one I want based on the description, and it’s the second from the top. How do I get it? I assume when I did hg clone https://...
it got the newest version
Upvotes: 0
Views: 58
Reputation: 177461
Just clone the whole repository, then update to the second newest commit with hg update -r -2
.
Note that if you have branches, the "second newest commit" may be on a different branch. In that case, you can list the latest two changes on a particular branch with hg log -b <branch> -l 2
, then hg update -r <rev>
to the older of the two changesets listed for that branch.
Another way to get the 2nd newest commit on a branch is the following syntax:
hg update <branch>^
For example:
hg update my_branch^
Note on Windows ^
is an escape character for the console, so it must be doubled for one literal ^
:
hg update my_branch^^
Another way to get the first ancestor of a branch tip is:
hg update my_branch~1
See also hg help revsets
and hg help revisions
.
Upvotes: 2