In Git, an annotated tag is a way to mark a specific point in your repository's history with a permanent label that has additional metadata, such as a tagging message, the tagger's name, email, and date. Here's how you can create an annotated tag:
1. Open your terminal or command prompt.
2. Navigate to your Git repository where you want to create the tag.
3. Use the following command to create an annotated tag:
git tag -a <tag-name> -m "Your message here"
Replace <tag-name> with your desired tag name (e.g., v1.0) and "Your message here" with a description or message about the tag.
For example:
git tag -a v1.0 -m "Release version 1.0"
4. To verify the creation of the tag, you can list all tags in your repository:
git tag -l
5. If you want to see the details of the annotated tag, you can use:
git show <tag-name>
For example:
git show v1.0
6. If you need to push the tag to a remote repository, use:
git push origin <tag-name>
For example:
git push origin v1.0
Summary of the Command
- -a: Indicates that you want to create an annotated tag.
- -m: Allows you to provide a message for the tag.
Remember that annotated tags are intended for releases or significant milestones. If you just need a lightweight tag without additional metadata, you might consider creating a lightweight tag using git tag <tag-name>.