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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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
Community Members
Community Events
Community Groups

Cannot find / checkout remote branch after delete

I (a long time ago) deleted a branch via the BitBucket Cloud Web page / app.

A remote team member (junior / new developer-in-training) was on leave - but now is back and has been committing and pushing code changes to the deleted branch.

(They do not have the skills / code  / project oversight to do the merging. 
I did think that I would just get them to switch to the new branch and merge in all their changes into it. But this is beyond their current skillset) 

So I need to be able to checkout the remote branch to my machine, so that I can do the required merge(s) to get the new "main" brain up to date with his changes.

I have the remote path and the SHA of the last commit he pushed and tried the following;

get fetch
git checkout -b origin/theDeletedPath <the commitSHA>

But I get an error that I can't resolve:

fatal: reference is not a tree: <the commitSHA>

The branch I want to recover does not appear in BitBucket Cloud (I have ensured that I am looking for ALL branches - not just active.

I have tried;
git branch -a -v

The latest commit/push to the deleted branch (unsurprisingly) does NOT appear in the commits for the repo, either.

I'd really appreciate any thoughts you might have.


1 answer

0 votes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Aug 30, 2022

Hey Gavin,

If the remote branch has been deleted - you will not be able to push to the remote branch from your local.

I would suggest attempting to locate the local branch on the user's machine by running the git branch command to list only local branches.

Once this has been performed, you can then run a git checkout command to switch to the local branch and then push this to remote - once you push, this will create the origin/theDeletedPath linkage that you are expecting to see (if the branch name is different, you can rename the branch with git branch -m old_name new_name before pushing)

Unfortunately - if this data is lost and there is no local backup, our Cloud backups include the last 7 days of data in warm storage and any older is not easily recoverable.

Hope this helps.


- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events