How to tag and go to a tag in hg

mercurial

Solution

Tags are not branches. Tags are markers for a particular commit - basically, a way to name commits. That's all. You don't "switch a repository to a tag" any more than you would "switch a repository to a commit" - you can check out a tag, but all that does is roll back your working copy to the corresponding changeset which was tagged.

Branches are created automatically in Mercurial when you commit code that doesn't directly build off of the current head revision.

See here for some more details:

https://www.mercurial-scm.org/wiki/Tag

https://www.mercurial-scm.org/wiki/Branch

Problem

This website says `hg tag 1.0` is to get my Mercurial repository to a tag name. How can I switch my repository to that tag name? ``` $ hg tag myTag1.0 $ <edit more files> $ hg commit -m "a message" $ hg how to go back to that tag? ``` And if I make a new `hg commit` here, what will happen? Will it go to the branch of `myTag1.0`? Or will it stay on the default branch?

Original source