Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the sequence for tagging commit in git?

Tags:

I cloned a git repo and made some changes. I have to commit changes and then tag those committed changes. What should be the sequence of commands? Is it like: git clone, git add, git commit, git push, and then git tag?

If not, what is the sequence ?

like image 780
Chandu Avatar asked Feb 05 '16 09:02

Chandu


People also ask

What is tagging a commit?

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.

How will you list your tags in Git?

List Local Git Tags. In order to list Git tags, you have to use the “git tag” command with no arguments. You can also execute “git tag” with the “-n” option in order to have an extensive description of your tag list. Optionally, you can choose to specify a tag pattern with the “-l” option followed by the tag pattern.

Can we commit in tag in Git?

Well, in git, a tag is unique to a commit. However, if you really want to use a tag you already used before you will need to delete it from remote and local and recreate it.


1 Answers

You can tag a revision right after your commit or later (after a push). Then, you can push your tag with: git push origin [tagname].

So, yes, your sequence is ok. Take a look at this, for more details: https://git-scm.com/book/en/v2/Git-Basics-Tagging.

like image 191
Linkid Avatar answered Sep 16 '22 22:09

Linkid