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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,443
Community Members
 
Community Events
184
Community Groups

Creating branch from an old commit

Hello, how can i create a branch from an old commit?

 

thanks

1 answer

1 accepted

Kristy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2018

Unfortunately there is no way in the UI to create a branch from an old commit.

You can create a branch from a commit in git using your terminal and the command:

git branch <branchname> <commitHash>
Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2018

 

There is a way.  It's a little awkward, but it works.

1.  Click on the commit in the web UI.

2.  Click on the "[+]" button next to the word "No Tags" (far right middle of screen).  (Or if the commit already has a tag, just use that to create the branch.)

3.  Create a temporary tag against the commit.  Click the "Create Tag" button to save your tag.

4.  Go to the "Create Branch" dialog.  Find your tag.  Use that!

5.  Go back to the commit from step 1. and delete the tag you created.

 

By cosmic coincidence, this works on both Bitbucket Cloud (bitbucket.org) AND Bitbucket Server!  Despite these two Bitbucket implementations being very different, the UI for doing this is pretty much the same in both.

- Sylvie @ Bit-Booster

(We maintain 3 add-ons for Bitbucket Server:  Rebase Squash Amend, Git Graph for JIRA, and Control Freak).

Like # people like this
Kristy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2018 • edited

I actually hadn't considered doing that. It's certainly not our recommended way of creating a branch from a commit, but you're right - it works!

If someone wants to create branches often then they are probably going to have a clone handy - in which case it would be easier to just do it locally and push the ref. But if this is a one-off, and the person creating the branch doesn't have a local clone, then perhaps doing it in this round-about way would be quicker!

Hello Kristy

Even when you have a local clone, some repositories will let you only push commits that are signed by you. (I.e. you won't be allowed to push commits stored in your local clone that are signed by your colleague.)

Cheers

  Jarda

I can follow steps 1-4, but how do I perform step 5 "Go back to the commit from step 1. and delete the tag you created"?  A Bitbucket Cloud commit lists all the tags associated with the commit, but AFAICT it doesn't provide an option to delete a tag.

Either I must leave the temporary tag or use the terminal to delete the tag.  And if using the terminal, I might as well use it to directly create the tag.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events