🤓
Thomas lab
Git&Github
Git&Github
  • Fetching & Pulling
  • Git alias
  • Git & Github : What is in .git ?
  • Git Rebase
  • Git reflog
  • Git Stash
  • Git tags
  • Git Workflow(Collaboration)
  • Quick High-Level
  • Git diff
  • Git installer
  • Reset & Revert commit
  • Github Collaborators
  • Github Basics
  • Introducing Git
  • Merging Branch
  • How to use multiple account
Powered by GitBook
On this page
  • The two types
  • Semantic versioning
  • Initial release
  • Path Release
  • Minor Release
  • Major Release
  • Viewing tags
  • Viewing Tags
  • Checking out tags
  • Creating lightweight tags
  • Annotated Tags
  • Tagging previous commit
  • forcing tags
  • delete tags
  • pushing tags

Git tags

PreviousGit StashNextGit Workflow(Collaboration)

Last updated 8 months ago

Tags are pointers that refer to particular point in git history. We can mark a particular moment in time with a tag. Tags are most often used to mark version releases in projects (v 4.1.0, v4.1.1, etc)

Think of tags as branch references that do not change. once a tag is created, it always refers to the same commit . It's just a label for a commit . 

The two types

There are two types of Git tags we can use : lightweight and annotabted tags .

lightweight tags are ..lightweight. They are just a name/label that points to a particular commit .

annotated tags store extra meta data including the author's name and email, the data,and a tagging ,essage (like a commit message)

Semantic versioning

The semaintic versioning spec outlines a standardized versionning system for software releases. It providers a consistent way for developers to give meaning to their software releases. (how big of a changes is this release)

Version consist of three number separated by periods

Initial release

typically, the first release is 1.0.0

Path Release

Path releases normailly do not contain new features or significantly change. They typically signnify bug fixes and other changes that do not impact how the code is used.

Minor Release

Minor release signify that new features or functionality have been added ,but the project is still backward compatible.No breaking changes .THe news functionality is optional and should not force users to rewrite their own code.

Major Release

Major release signify that signify signifycant changes that is no longer backward compatible. Feature may be removed or changhed subsitaintially

Viewing tags

Git tag

git tag will print a list of all the tags in the current repository .

Viewing Tags

We can search for tags that match a particular pattern by using git tag -l and then passing in a wildcard pattern .For example, git tag -l "*beta*" wil print a list of tags that include "beta" in their name.

Checking out tags

To view the state of a repo at a particular tag, we can use git checkout <tag>. This puts us in detached HEAD !

Creating lightweight tags

to create a lightweight tag,use git tag <tagname> . by default, git will create the tag referring to the commit that head is rederencing .

Annotated Tags

Use git tag -a to created a new annotated tag . Git will then open you default text editor and prompt you for addtional information. Simmilar to git commit, we can also use the -m option to pass a message directly and forgo the openning of the text editor.

Tagging previous commit

So far , we've seen how to tag the commit that HEAD references . We can create tag an older commit by providing the commit hash : git tag -a

forcing tags

git will yell at us if we try to reuse a tag that is already referring to ad comit . if we use the -f option, we can force our tag throught .

delete tags

to delete a tag, use git tag -d <tag-name>

pushing tags

git push --tags 

By default, the git push command doen't transfer tags to remote servers.If you have a lot of tags that you want to push up at once, you cna use the --tags option to the git push command. this will transfer the tags all of your tag to remote servers that are not already there.