Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tag and go to a tag in hg

Tags:

mercurial

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?

like image 649
michael Avatar asked Apr 26 '10 15:04

michael


People also ask

How do you tag in mercurial?

To add a tag to the system, simply add a line to this file and then commit it for it to take effect. The hg tag command will do this for you and hg tags will show the currently effective tags.

How do I switch between branches in mercurial?

From the main menu, select Hg | Mercurial | Update to. In the Switch Working Directory dialog that opens, specify the target working directory: To switch to another line of development, choose Branch and select the desired branch from the list.

How do you switch branches in Heartgold?

Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed.

How do you remove a tag on mercurial?

If you want to remove a tag that you no longer want, use hg tag --remove . You can also modify a tag at any time, so that it identifies a different revision, by simply issuing a new hg tag command. You'll have to use the -f option to tell Mercurial that you really want to update the tag.


2 Answers

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

like image 107
Amber Avatar answered Oct 07 '22 21:10

Amber


Just update to the tag name.

hg tag 1.0
... make changes ...
hg ci
hg up 1.0
like image 41
Robert Avatar answered Oct 07 '22 21:10

Robert