Repository tags
Tags mark a specific commit at a point in your repository history. When you tag a commit, you're including all the changes before it. You can later compare tags to see the difference between two points in history. Tags are commonly used to mark release versions, with the release name as the tag name.
Bitbucket Cloud supports tags for Git repositories. You can create a tag in Bitbucket or locally and push it to Bitbucket.
Create a tag in Bitbucket
From your Bitbucket repository or pull request, click the link for the commit you want to tag.
In Details on the right sidebar, select Create tag in the Tags card on the right sidebar.
Enter a Tag name and click Create tag.
Removing a tag
You can't remove a tag from Bitbucket after you've added it. To remove a tag, you'll have to do so from the command line.
See the commits for a tag
Select the Commits link the left panel of a repository.
Select the filter dropdown above the list of commits.
Click the Tags tab.
Search for and click the tag you want to see. The Commits list updates with all the commits for that tag.
Create and push a tag to Bitbucket
You can create tags locally for your Git repositories. Depending on the type of tag you create, they'll appear in Bitbucket anywhere that lists your tags for a commit.
Tags for Git repositories
While Git supports annotated and lightweight tags, you can only create and see annotated tags in Bitbucket. Git stores annotated tags as full objects in the repository, which means they include the name, email, date, and have a message. Lightweight tags don't include all this additional information.
Use the following commands to create, push, and perform other tagging options for Git repositories.
Tag task | Git commands |
---|---|
Create an annotated tag | 1
git tag -a <tag_name> -m '<tag_message>' |
Create a lightweight tag | 1
git tag <tag_name> |
Push all your tags (a regular push won't push a tag) | 1
git push origin --tags |
Push a single tag | 1
git push origin : <tag_name> |
List the tags in a repository | 1
git tag |
Remove a tag from a repository | 1
git tag -d <tag_name> 1
git push origin :refs/tags/<tag_name> |
Compare the diffs with tags
Once you've got at least one tag, you can compare that tag with another tag or a branch.
Select the More options () button and select Compare branches or tags.
From each dropdown, select the tag or branch that you want to include as part of the comparison.
Click Compare.
You'll see a diff, a list of commits, and any pull requests merged between the two versions.
Sign tags with your GPG key
Add the -S flag to your git tag command:
1
git tag -S yourtag
You can verify a tag was signed using this command:
1
git tag -v yourtag
Was this helpful?