Git:Tag
lastmod 2015-03-06created 2014-10-206 edits
You can tag important points in a project's history. This feature is generally used to mark S/W release points, such as version 1.0.
Types of tags
Git has two types of tags: Lightweight tags and Annotated tags.
- A Lightweight tag is similar to a branch, but unlike a branch it does not move the point it refers to the latest commit. It is simply a pointer to a specific commit.
If you just need a simple tag that stores no other information, use a Lightweight tag. - An Annotated tag stores in the Git database the tagger's name, email, the date the tag was created, and a tag message. It can also be signed with GPG (GNU Privacy Guard).
Annotated tags are recommended only when you need to store all this information.
Annotated
Creating an Annotated tag is simple. Add the -a option when running the tag command:
Lightweight
A Lightweight tag basically just stores the commit checksum in a file. No other information is stored. Do not use the -a, -s, or -m options when creating a Lightweight tag:
Sharing tags
-
git push [원격저장소명] [태그명] -
git push [원격저장소명] [로컬브랜치명] --tags
By default, the git push command does not send tags to the remote repository. After creating a tag, you need to explicitly push it to the remote server. The process is similar to sharing remote branches. Run the git push origin [tagname] command as follows.
Just as you can push with git push by omitting orgin master from git push origin master because it is the default, you can push all tags for the master branch to the origin remote repository with git push --tags.