{"id":6,"date":"2024-11-11T06:15:35","date_gmt":"2024-11-11T06:15:35","guid":{"rendered":"https:\/\/hellonitish.com\/wp\/?p=6"},"modified":"2025-11-04T04:45:30","modified_gmt":"2025-11-04T04:45:30","slug":"using-github-repository-tags-and-their-benefits","status":"publish","type":"post","link":"https:\/\/hellonitish.com\/blog\/using-github-repository-tags-and-their-benefits\/","title":{"rendered":"Using GitHub Repository Tags and their benefits"},"content":{"rendered":"\n<p>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&#8217;s history.<\/p>\n\n\n\n<p>Let me begin by telling you why I started using them.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Grabbing CDN Links for my GitHub Repositories<\/h2>\n\n\n\n<p>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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;cdn.jsdelivr.net\/gh\/yourusername\/yourrepo@main\/file-you-want<\/code><\/pre>\n\n\n\n<p>For instance, the <strong>neat-gradient.js<\/strong> file from my <a href=\"https:\/\/github.com\/9itish\/neat-animated-gradients\" data-type=\"link\" data-id=\"https:\/\/github.com\/9itish\/neat-animated-gradients\">Neat Animated Gradients<\/a> repository will have the following URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;cdn.jsdelivr.net\/gh\/9itish\/neat-animated-gradients@main\/neat-gradient.js<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Making Breaking Changes to the Code Broke Functionality for Others<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>This prompted me to look for solutions.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do I add Tags to GitHub Repositories?<\/h2>\n\n\n\n<p>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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git tag v1.0.0<\/code><\/pre>\n\n\n\n<p>Of course, the version changes with each update depending on how much and what I changed.<\/p>\n\n\n\n<p>After that, I push the tag to the GitHub repository with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push origin v1.0.0<\/code><\/pre>\n\n\n\n<p>The keyword <strong>origin<\/strong> simply refers to the remote version of your repository.<\/p>\n\n\n\n<p>Here are the tags for <a href=\"https:\/\/github.com\/9itish\/neat-animated-gradients\" data-type=\"link\" data-id=\"https:\/\/github.com\/9itish\/neat-animated-gradients\">Neat Animated Gradients<\/a> when I wrote this post.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\" class=\"n-bshadow n-round-x2\"><img decoding=\"async\" width=\"1024\" height=\"395\" loading=\"lazy\" src=\"https:\/\/hellonitish.com\/wp\/wp-content\/uploads\/2024\/11\/image-1024x395.png\" alt=\"\" class=\"wp-image-10\" srcset=\"https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1024x395.png 1024w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-300x116.png 300w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-768x297.png 768w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image.png 1155w\" sizes=\"auto, (max-width: 767px) 100vw, (min-width: 768px) and (max-width: 1300px) 66.67vw, 765px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Associating Releases with GitHub Tags<\/h2>\n\n\n\n<p>Tags point to a specific commit in your GitHub repository. You can make them more informative by associating a release with them.<\/p>\n\n\n\n<p>For instance, here is a screenshot that shows the release for my Neat Animated Gradients Library at v1.0.2.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\" class=\"n-bshadow n-round-x2\"><img decoding=\"async\" width=\"1024\" height=\"512\" loading=\"lazy\" src=\"https:\/\/hellonitish.com\/wp\/wp-content\/uploads\/2024\/11\/image-1-1024x512.png\" alt=\"\" class=\"wp-image-12\" srcset=\"https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1-1024x512.png 1024w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1-320x160.png 320w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1-460x230.png 460w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1-640x320.png 640w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1-800x400.png 800w, https:\/\/hellonitish.com\/blog\/wp-content\/uploads\/2024\/11\/image-1.png 1151w\" sizes=\"auto, (max-width: 767px) 100vw, (min-width: 768px) and (max-width: 1300px) 66.67vw, 765px\" \/><\/figure>\n\n\n\n<p>When you create a release, GitHub automatically creates a zip file and a tarball for you to download. They contain all the repository&#8217;s contents at the point when you created the associated tag.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s history. Let me begin by telling you why I started using them. I use many open-source libraries in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":12,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[4],"class_list":["post-6","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev-notes","tag-github"],"_links":{"self":[{"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":9,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":23,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/posts\/6\/revisions\/23"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/media\/12"}],"wp:attachment":[{"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hellonitish.com\/blog\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}