GitHub allows you to tag your repository commits with an optional comment. Adding tags to your GitHub repository as you update its code has many benefits. These tags allow you to mark specific points in your repository’s history.
Let me begin by telling you why I started using them.
I use many open-source libraries in my development work and wanted to give back to the community. I had very few open-source projects on GitHub and wanted to create some helpful libraries and frameworks that anyone can use.
Grabbing CDN Links for my GitHub Repositories
I use the code I upload to GitHub in my own projects as well. I knew I could get a CDN link to different repository files like this:
https://cdn.jsdelivr.net/gh/yourusername/yourrepo@main/file-you-want
For instance, the neat-gradient.js file from my Neat Animated Gradients repository will have the following URL:
https://cdn.jsdelivr.net/gh/9itish/neat-animated-gradients@main/neat-gradient.js
Making Breaking Changes to the Code Broke Functionality for Others
Initially, I would make changes to the code and commit them to the repository knowing I could just grab the latest version using the above URL.
Later, I made some breaking changes to the code which meant that any third-party code that relies on my library will no longer work if it is also linking to the latest library version.
This prompted me to look for solutions.
I noticed that many other popular libraries used tags and releases to mark specific commits in the repository. I read more about it and started doing it myself.
How do I add Tags to GitHub Repositories?
Once I have committed the changes I made locally to my GitHub repository, I create a tag by executing the following command in the terminal (cmd.exe for me) with the project directory:
git tag v1.0.0
Of course, the version changes with each update depending on how much and what I changed.
After that, I push the tag to the GitHub repository with the following command:
git push origin v1.0.0
The keyword origin simply refers to the remote version of your repository.
Here are the tags for Neat Animated Gradients when I wrote this post.

Associating Releases with GitHub Tags
Tags point to a specific commit in your GitHub repository. You can make them more informative by associating a release with them.
For instance, here is a screenshot that shows the release for my Neat Animated Gradients Library at v1.0.2.

When you create a release, GitHub automatically creates a zip file and a tarball for you to download. They contain all the repository’s contents at the point when you created the associated tag.