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

How to restore cloud repo before a "git push -f origin dev" ?

Priteesh Kissoondhery March 14, 2022

Our main development branch is called "dev" in this scenario.
Accidentally did a "git push -f origin dev" which pushed my outdated local dev branch to shared repo.

can't seem to find the hash for this change using git log to reflog.

How can I restore the repo ?


1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 15, 2022

Hi @Priteesh Kissoondhery,

I would suggest the following:

1. First, check the following documentation:

Please check all the steps there, including the sections titled

  • "If you don't know the 'sha' off the top of your head, you can:"
  • "If your commits are not in your reflog:"

See if you can recover the branch with any of the methods described there.

 

2. If the above is not possible: are there any other users with access to this repository?

If so, I would suggest asking them if anyone has the previous version (the one before your force push) of the dev branch in their local clone. If so, they can force push it to the repo.

 

3. In case neither step 1 nor step 2 work for you, we may be able to recover a backup of the repo for you prior to the force push.

Please note that this is only possible if the force push was made during the last 7 days; we are not able to recover any content older than 7 days.

If neither step 1 nor step 2 work for you, and the force push was made during the last 7 days, then:

  • You can create a ticket with the support team to ask for a backup of the repo prior to the force push (let them know when you made the force push, so they provide you with the most recent backup prior to the force push).

    If the repo is owned by a workspace on a paid billing plan, you can create a support ticket via https://support.atlassian.com/contact/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. In the question "What is the impact to your business?" please make sure to select "Level 1".

  • If the repo is owned by a workspace on the free plan, you won't be able to create a support ticket yourself. Please feel free to let me know and I can create the support ticket for you.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events