Is it OK to open the .hgtags
file in the mercurial root directory with NotePad
and remove all the tags, if you have forked a template project?
Or is there a single command where I can simply say remove all previous/old tags?
Is it OK to open the .hgtags file ... and remove all the tags?
Maybe
The way .hgtags
works is that Mercurial tracks it across all heads (branches) in your repository. This is so tags can be propagated intelligently and new tags from 2 developers can be combined when a merge is done so that tags from both are usable.
The file itself is user-editable. For instance, it could have a merge conflict that you would resolve by manually editing it. So editing it per-se is not prohibited.
But if you simply delete from it, and later merge from another branch, deleted tags could come back!
So the correct general approach is to delete them properly. However there is a shortcut...
Standard way to delete would be:
hg tag --remove tagname
one by one...
OR you can add tagname 0000000000000000000000000000000000000000
to the end of .hgtags
. Do this for the name of each tag you wish to delete.
(The 000...
code tells Mercurial to treat it as deleted.)
So in summary - if you are confident you could NEVER merge in any tags you wish to delete, then you can just remove all the tag lines in .hgtags
.
Otherwise, if you only have a few tags to delete, use command hg tag remove
.
If you have a huge # of tags, manually inserting the deletion code might be a faster approach.
Reference: https://www.mercurial-scm.org/wiki/Tag#How_do_I_remove_a_tag.3F