hogsolo hogsolo - 1 year ago 114
Git Question

How to tag an older commit in Git?

We are new to git, and I want to set a tag at the beginning of our repository.
Our production code is the same as the beginning repository, but we've made commits since then.
A tag at the beginning would allow us to "roll back" production to a known, stable state.

So how to add a tag to an arbitrary, older commit?

Answer Source


git tag -a v1.2 9fceb02 -m "Message here"

Where 9fceb02 is the beginning part of the commit id.

You can then push them up using git push --tags origin master

You can do git log to show all the commit id's in your current branch.

There is also a good chapter on tagging in the Pro Git book.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download