7

I pushed on the wrong repo, and now the admin wants me to remove my last push. I can't just delete the repo.

Screenshot of push on Bitbucket

How do I remove my push from the repo?

Burning Crystals
  • 1,157
  • 3
  • 19
  • 35

1 Answers1

8

In the admin settings of each repository, there's a menu item called Strip commits:


strip commits 1


To delete your complete push, you need to strip the first (oldest) revision that you pushed.

Bitbucket will then remove this revision and all its descendants:


strip commits 2

Christian Specht
  • 35,843
  • 15
  • 128
  • 182
  • 2
    Can you describe how to find this menu in the 2017 version of Bitbucket? Thanks. – Aïssa Mar 09 '17 at 09:32
  • @AïssaGhouti: I just updated the answer. It's basically the same as before, it's just that the "Settings" link is now somewhere else on the page. – Christian Specht Mar 09 '17 at 17:42
  • I can't find it. You seem to have missed step 0. – ctrl-alt-delor Apr 28 '21 at 09:24
  • For everyone who can't find it now: please note that the question (and my answer) is about **Mercurial** repos on Bitbucket. At the time I wrote this answer, Bitbucket supported Git **and** Mercurial, IIRC they dropped Mercurial support in 2020. Stripping commits is a Mercurial feature, so Git repos don't have the menu item at all. Today, I can't find it either. – Christian Specht Feb 25 '22 at 23:01