Search code examples
mercurial

How to checkout most recent revision of the current branch in Mercurial?


Let's say I updated to an older revision in my working directory to do some tests, and now I want to switch back to the most recent revision.
I thought tip would do the trick but no, this tag is the most recent revision on the repo, not only in my current branch.

Is there any tag to update to that means "most recent commit of your current branch"?


Solution

  • hg update with no argument will do the job. When you don't specify any revision, the update command will automatically update to the most recent commit of the current branch. That was easy after all.

    If no changeset is specified, update to the tip of the current named branch and move the active bookmark

    https://www.mercurial-scm.org/doc/hg.1.html#update