Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to tag a repository or code in the master branch

Tara Pandey April 4, 2023

There is information for this topic at but it does not work.

Repository tags | Bitbucket Cloud | Atlassian Support

None of it looks a real information. Has anybody used this information to tag the whole code in a branch?

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2023

Hello @Tara Pandey ,

Thank you for reaching out to Atlassian Community!

Git tags are attached to commits, not branches. In order to tag a commit in the Bitbucket Cloud UI you can navigate to the repository in question, access the Commits page in the left panel and open the exact commit you want to tag. In the details on the right side of the page, click the + button as in the image below : 

Screenshot 2023-04-06 at 4.46.38 PM.png

You will then need to provide the tag name and an optional description.

Another option is to create the tag in your local clone of the repository and then push it back to Bitbucket. You can follow the below steps to use this approach : 

1. Access the folder of your local clone of the repository

2. Checkout to the commit you want to tag

git checkout <commit hash>

3. Add the tag to the commit using the git tag command 

git tag -a <tag_name> -m '<tag_message>'

4. Push the tag to Bitbucket Cloud

git push origin --tags

Hope that helps! Let me know in case you have any questions :)

Thank you, @Tara Pandey !
Patrik S

Tara Pandey April 7, 2023

Thank you for your reply @Patrik S.

I knew about the tagging the commit but if I would want to tag the whole source code NOT just the last commit for a Release (release point), can I achieve this but just tagging the last commit in that repository/branch?

I have almost 100 commits by different team members over the course of last 6 months and now I want to release the code, tag it for future refences and move on coding next features but would like to use the same branch for future code pushes.

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2023

Hello @Tara Pandey ,

When you tag a commit, you are not only including the changes introduced by that particular commit, but rather you are including all the changes before it as well. You can see a tag as the state of your source code at a given point in time. 

So if you tag the latest commit of your repository, when doing check out or clone of that tag locally, it will include all the changes introduced by the previous commits as well.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events