Late Git Tagging
Git tagging is useful for marking the point of the release cycle of a version. But sometimes, we forget to even implement git tag
. Here are some quick commands on how to do it for those that are still new to git.
Detach from head
git checkout 7b027ef
7b027ef
could be any hash, this is just from a real-world example. Then a long-ass message will appear. This seems scary to read but no need to panic. Just continue with git tagging.
Note: switching to '7b027ef'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
Time to git tag and push.
git tag -a ios-v5.3.4 -m "5.3.4 (113)"
git push origin ios-v5.3.4
Here comes the tricky part, how to get back to the previous branch before the head was detached. Simple just run checkout again.
git checkout develop