Add tags to commits in Bitbucket

Git tags have become essential to a Git workflow to mark specific points in your Git history (like referencing a specific version of a project by tagging a commit for your release). They reduce complexity, clean up your branch workflow, and are a way to mark exact versions of commits. If you change versions a lot, they are a life saver for an organization instead of just using branches, which commonly leaves you with lots of rarely used branches.

Here’s a look at a hypothetical scenario for adding tags: You’re a release manager getting ready for a release so you navigate to Bitbucket’s UI and view all the commits, looking for the one that has all the features you want to include and has passing builds. You find the commit and realize that it is missing a release tag, so you go to the command line – create and push the tag so you can tag the commit for the release, then go back to Bitbucket’s UI to view the tag and ultimately, do the release. This is a major pain (shakes fist at context switching).

Add tags from the UI vs the command line

Bitbucket users have asked us how they can cut out this back and forth and tag commits directly from Bitbucket Cloud’s UI, and today we’re launching this capability to add annotated git tags and regular mercurial tags directly to commits from the UI. The name of the tag, date/time, and author can be applied to any commit.

If you’re reading this thinking “why would someone tag a commit from the UI? The command line works just fine for me.” Lets look at where you can save time and find commits that need tagging in Bitbucket without switching over to the command line:

  • Branches page: Quickly check that all features scheduled for release have been merged into your main branch, before creating your tag.
  • Commit’s build status: Double-check the build status of your commit. If there’s a failing build, you might want to push some fixes before creating your tag!

Add tags from Bitbucket’s UI

To add a tag, navigate to a commit in your repository and click on the commit in need of a tag. In the details pane, on the right side of the commit view, you can see ‘current tags’ and ‘create tag’. Once ‘create tag’ is selected, the author and timestamp will automatically be recorded.

In the future we will be expanding tagging from the UI with the ability to add custom messages to compliment any annotated git tag applied in the UI. If you are looking for lightweight tags, they can still be added via our API but are not currently available in the UI.

Try tagging commits

If you already use Bitbucket, start saving time with this new feature and start tagging (allthethings). If you're new to Bitbucket, sign up for a Bitbucket Cloud account, create a repo and make a commit to take it for a spin. If you get stuck, more in depth tagging documentation is available here.

Get started, it’s free

Have more specific questions about this post? Reach out to us on Twitter to get the information you need