Sobes.tech
Junior — Middle

How can you set a commit tag in Git?

sobes.tech AI

Answer from AI

In Git, a tag can be created using the command git tag. There are two main types of tags: lightweight and annotated.

  • Creating a lightweight tag:
git tag <tagname>
  • Creating an annotated tag (with a message and metadata):
git tag -a <tagname> -m "Tag description"

After creating a tag, you need to push it to the remote repository:

git push origin <tagname>

Example:

git tag -a v1.0 -m "Release version 1.0"
git push origin v1.0
How can you set a commit tag in Git? — DevOps - sobes.tech