Before we get started on how to push a Git tag, let’s give a quick refresher on the fundamentals of tags in Git.
What is a Git tag?
A Git tag is a reference to a specific commit within the history of a Git repository. In Git, tags are often used to mark releases, for example, but they can also be useful anytime you want to reference a commit without needing to use the commit hash.
Before you can Git push a tag, you will have to create the tag. We’re going to review the process of creating and pushing a Git tag using the cross-platform GitKraken Git GUI before going through the process in the CLI.
GitKraken’s easy-to-read commit graph will give you more insight into your branches and tags, and makes pushing changes to your remote safe, fast, and ridiculously easy.
How do you create a Git tag in GitKraken?
The beauty of using GitKraken to visualize your repositories is having immediate insight into your branches and commits. The central UI displays all of your commits listed in chronological order so you know exactly what’s going on in any given project.
To create a Git tag in GitKraken, you will find the Git commit that you wish to tag from the central graph and simply right-click the commit. You will then select the option to Create tag here from the drop-down menu.
Next, you will type the name of your Git tag in the box next to the commit and press enter. That’s it!
How do you create an annotated Git tag in GitKraken?
GitKraken also allows you to create annotated tags using the same process. Just right-click on the commit you want to tag and select Created annotated tag here.
This will open a dialog box at the top of the graph that will allow you to enter a message to go with the Git tag.
Your annotation will appear as a tooltip when you hover over your tag in the central graph.
How do you Git push a tag?
After you have created your Git tag, you will have the ability to Git push the tag to your remote.
By default, Git tags are stored locally on your machine and are not pushed when the Git push command is run.
How do you Git push a tag in GitKraken?
To Git push a tag in GitKraken, simply right-click on the Git tag and select Push <tag-name> to origin.
Now, because you have Git pushed your tag, it will be pulled down whenever someone performs a Git pull on your remote repository. Just 2 clicks and you’re done. 💥
With GitKraken, you can push a tag to your remote in just 2 clicks. Speeding up smaller tasks in your workflow leads to huge productivity benefits. Giving you more time to do….whatever you want.
How do you create a Git tag in the command line?
Without the immediate visual context offered by GitKraken’s central graph, you are going to have to run a command to view your commit history in the CLI.
git log --pretty=oneline
In this example, running that command will show that there are two commits in the repository.
To Git tag the most recent commit, you will use the following command:
git tag <tag-name>
In this example, the tag name will be
Now, if you want to Git tag an older commit in the CLI, you will need a portion of the commit hash to add at the end of your command. Let’s add a Git tag to the
Initial commit in this example using
To include a message with the Git tag, you can create an annotated tag using the
-a flag and then add a message with the
git tag -a <tag-name> -m “tag-message”
How do you use the Git show tag command?
To verify that your Git tag was annotated correctly, you can run the following command:
git show <tag-name>
This command should render the following information to verify the annotation on the Git tag.
How do you Git push a tag in the command line?
To Git push a tag in the terminal, you will use the following command. In this example,
this-is-a-tag is the name of your tag.
git push origin this-is-a-tag
How do you Git push all tags?
To Git push all the tags you have locally to your remote repository, you will use the following command:
git push origin --tags
The GitKraken Git GUI offers more visibility into your commits, branches, and Git tags, making it quick and easy to find and push tags to your remote when the need arises. Developers using GitKraken speed up daily Git actions and make more advanced tasks, like Git interactive rebase, safe and intuitive.