This question arises more out of curiosity and not due to issues faced while using git.
git allows you to make empty commits with git commit -m "message" --allow-empty
You can also tag specific revisions using git tag -a v1.4 -m 'my version 1.4'.
For all practical purposes I can think of right now, like making a tag to signify an important commit, deploying a particular tag, creating tag to specify version bumps, we can create an empty commit with the same message and then use it instead of the tag.
So, what is the advantage of using tags over empty commits, and vice versa?
You can immediately checkout a tag. E.g. after deploy to production you do something like
git tag -f production
and if you ever need to test something, as it is deployed, you can do
git checkout production
Also, extra advantage: no empty commits!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With