Contents
A tag is a pointer to a commit, and commits exist independently of branches. That commit can be pointed to from any number of branches – i.e., it can be part of the history of any number of branches – including none.
A tag represents a version of a particular branch at a moment in time. A branch represents a separate thread of development that may run concurrently with other development efforts on the same code base. Changes to a branch may eventually be merged back into another branch to unify them.
What happens when you tag a branch?
Tagging is generally used to capture a point in history that is used for a marked version release (i.e. v1. 0.1). A tag is like a branch that doesn’t change. Unlike branches, tags, after being created, have no further history of commits.
Which is better to use tags or branches?
Long Answer: I believe using tags for release versioning specifically is better than using branches. If you need to update the relase, simply branch off of the tagged commit and once you finish working on that branch (most likely a hotfix branch), create a new tag at the head of that new branch with the new version.
Which is better a tag or a branch in Git?
Edit: Here is a nice way to use git that I use for all my projects. A tag is immutable. Whereas you can create a branch named “1.0.0” – you, or anyone with commit rights, can also then simply push to that branch (deliberately or not) and change what 1.0.0 means.
Can you delete a tag from a branch?
* You can delete and recreate a tag thereby changing a tag, but certainly not by accident. Branch and tag are the same thing (pointer to a commit, aka. “ref” ), except branch automatically moves to the next commit while tag stays forever 1 on the same commit.
Why do you use tags in a git commit?
Tags are mainly used for future reference to the specific version of the project, by tagging a commit. You can always use branches of course, but if you change versions a lot, you will end up with lots of unused or rarely used branches.