Reputation: 1049
In mercurial how can I go back n
revisions from the revision I'm currently on?
This answer shows how it can be done in git: https://stackoverflow.com/a/16739578/1696114, git checkout HEAD~n
.
If there isn't a way to go back n
revisions, is there a way to go back just to the parent revision (i.e. one revision back)?
Upvotes: 3
Views: 128
Reputation: 489888
Instead of HEAD~n
, use .~n
.
hg help revisions
shows you Mercurial's revision specifiers.
The Mercurial equivalent of Git's HEAD
/@
is .
, and the Mercurial equivalent of Git's ~number
is ... ~number
😀
Like Git, Mercurial also supports the ^
suffix, with the same meaning: ^
followed by a number is the number-th parent.
Omitting the number gets you the first parent, or steps back 1 first-parent (which gets you the first parent), so .^
or .~
gets you the first parent. Note that some Windows command line interpreters like to use ^
for their own purposes so that you may have to quote them.
Upvotes: 5