Tagging commits to identify versions of code
Now that you understand how and why developers commit code to Git, we can explain tagging. Tagging is simple: it’s a way to add a permanent label to a commit. There are many reasons to tag, but the two most common are to mark the exact version of code that is released to customers and to have a convenient way to return to a particular version of the code if you need to revert a large batch of changes. Let’s look at an example of each.
Imagine that Hats for Cats is ready to release version 0.1-beta to users. Tagging a particular commit with that version number lets you know exactly what features have been deployed into production and are available to your users, which tells you which version of the code to fix as you triage bug reports. Adding this sort of identification via a tag is easy in Git. First, make sure that you have committed all the edits to all the files you want to include in your release. Then, use the git...