Using git tags

You likely won't need to use tags for course projects, but they are handy for long-lived projects, particularly for code that you may want to release. A tag is a way to name a snapshot of the repository. It is often useful for code releases and for tagging big version changes to code. A tag is like a static branch (you cannot update the tagged version, but you can check it out just like any branch).

Here are some tag commands:

# list all current tags associated with a repo
git tag -l

# create a new tag named v1.0 with a tag message (optional)
# and share a tag: push the tag to the origin to share it:
git tag -a v1.0 -m "initial version"
git push origin v1.0

# checking out a specific tagged version of the code
# (checkout v1.0 of code into a local repo named version1)"
git checkout -b version1 v1.0

# to list other data along with the commit for a specific tag
# (this will show the commit number, date and who created the tag):
git show v1.0