How to create a GitHub tag for your last commit?

This is a short blog post about: how to create a tag for your last commit in GitHub? It’s good to have tags as they help you easily compare changes to your source code on GitHub.

It needs only five steps 😉 .

Step1: Get the last git commit ID

git rev-parse --short HEAD

Note: Useful stackoverview entry

  • Example output:
b5147bb

Step 2: Create a tag

git tag -a v0.0.1-verify-scripts b5147bb -m "Reflect all changes related to the bash script automation for the Kubernetes setup"

Step 4: Push tag to repository

git push origin v0.0.1-verify-scripts

  • Example output:
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 224 bytes | 224.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/IBM/operator-sample-go.git
 * [new tag]         v0.0.1-verify-scripts -> v0.0.1-verify-scripts

Step 5: List existing tags

git tag

  • Example output:
v0.0.0-verify-scripts
v0.0.1-verify-scripts

Summary

It’s good to have tags, because they help you easily to compare changes in a GitHub project.
(here how to delete a tag)


I hope this was useful to you and let’s see what’s next?

Greetings,

Thomas

#github, #tag

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.