It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a way to rename a branch?

I apparently have some branches out of sync; is there a way to rename a branch?

3 answers

12 votes
Mikael_Sandberg Community Leader Mar 15, 2018

You would need to do the renaming locally in your repository. But before you do that, delete the branch in Bitbucket, do a fetch in your local clone to update it (if doing it from Sourcetree, make sure you check prune tracking branches, from cmd use git fetch -p). Then you can rename the branch and push it back to Bitbucket.

This might be helpful too.

From: https://www.w3docs.com

Officially I don't see a way to rename them, but we have had to do that in some cases.  What we do is basically the following

We have branch bugfix/JIRA-1  and want to rename it to bugfix/JIRA-100
All I usually do is take bugfix/JIRA-1 and create a branch off of that called bugfix/JIRA-100
At that point 1 and 100 should be identical.
I can then delete bugfix/JIRA-1.

You could do this via the bitbucket UI or command line as GErhard_Pretorius linked above.  I personally like the UI in this case as it saves me the step of having to push to origin.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Bitbucket Server 7.0 is here!

Hello Community, I’m Anton Genkin, a product manager on the Bitbucket Server and Data Center team and am excited to share that Bitbucket Server 7.0 is now available! It's a platform release, one th...

1,109 views 6 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you