Should I create a tag first before I do any changes though I know that I can tag it after the changes. Which workflow is better?
You don't have to, but it can help if you want to go back to an identified point.
You need to be aware of two kinds of tags though (as mentioned in git tag
):
- lightweight tags (reference for the SHA-1 object name of the commit object)
- annotated tags (independent tag object, including a creation date, the tagger name and e-mail, a tagging message, and an optional GnuPG signature):
git tag -a myTag
or git tag -m "new myTag" myTag
both created annotated tags.
git tag myTag
creates a lightweight tag only.
Annotated tags are meant for release while lightweight tags are meant for private or temporary object labels.
cannot verify a non-tag object of type commit.
You can only verify an annotated tags, since it is an independent object which can support an optional gpg signature (that is the signature you are trying to verify with the -v option).
A lightweight tag is just a shortcut to a commit.
git push --tags
in the Develop
branch:
That is an operation which will impact your remote upstream repo.
And it will push all tags, not just the ones set in the Develop branch.
To push only the ones that matters, I recommend git push --follow-tags
followed by a merge to the Master
branch,
That is a local operation done in your local repo, and has nothing to do with the git push
just done before.
do I still need to do another round of git push --tags
Both operations are completely unrelated.
How different are the tags different from branches? And which is better?
As opposed to SVN, tags are very different from branches and complement them: one isn't better than the other.
- branches are for isolating a development effort (see "When should you branch?").
- tags are for identifying specific points in history as being important (for instance, for marking releases).
Branches can be renamed or deleted easily.
(Annotated) Tags cannot be modified without affecting the history of the git repo.