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

  1. From your Bitbucket repository, click the link for the commit you want to tag.

  2. In the details on the right side of the page, click the + button.

  3. 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

  1. Click the Commits link the left panel.

  2. Click the dropdown at the top of the page.

  3. Click the Tags tab.

  4. 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.

  1. Select the More options () button and select Compare branches or tags.

  2. From each dropdown, select the tag or branch that you want to include as part of the comparison.

  3. Click Compare.

You'll see a diff, a list of commits, and any pull requests merged between the two versions.

 

Additional Help