Game Dev Adventures!, Helping Hand

Quick Git Tag Reference Guide (Make, View, and Rename)

Here’s a quick reference to the basic git tag commands that I use frequently, but not frequent enough to always recall offhand. For a more detailed explanation of everything you need to know about the basics of git tags go here.

Basic Tag Commands

These will get you through most things you need for tags.

Make a new tag
git tag tag_name -a -m "message about tag" //creates the tag

View tags
git tag //will show list of tags
git show tag_name //lets you view information about the specified tag including the message

Share tags
git push origin tag_name //will push specified tag(s) to repo

Advanced: Renaming Tags

After creating several tags on a game we were making, I realized we should have added version numbers to the tags so we could visually identify when each tag was made by its version number. This meant renaming tags, pushing changes to the repo, and then having my teammates clean their local repos.

I garnered valuable information on renaming tags from this stack overflow.

1. Rename the tag

Simple tag (not annotated)
git tag new old
Annotated Tag
git tag -a new old^{}

2. Delete the old tag and push changes to the repo

Both kinds of tags:
git tag -d old
git push origin new :old

3. Have team members update their local repos

Have team members run this:
git pull --prune --tags

Git Pro

To be a git pro just start practicing with git. Here are resource links I recommend to get started with git. For convenience, this is the book I recommend: Git Pro, which I explain on the resource links page as well. (#ThanksForYourSupport #CommissionsEarned)

Advertisement