How to delete commits forever from bitbucket?

I have a set of commits (not belonging to any branch). I'd like to delete them, so that the commit history does not show them. Is this possible?

1 answer

1 accepted

0 votes
Accepted answer
Jason Worley Atlassian Team Sep 02, 2014

Hi Jason!

I would like to ask connecting to this question. I am able to remove commits of a branch via force pushing from a local repository, where I reseted the branch before it, and it works fine. However, I am still interested in what happens to the commit (at your side) after then? In the project news feed there is an entry about I uploaded a commit (which I then removed via force push), I can click the commit id, check the changes and even check the source for it.

So the commit itself is not included in any of our branches anymore. Is it kept being stored permanently anyways, and will I be able to check it anytime on the link given in the project news feed? Or are these floating commits get removed by time? Should I even care about those commits or how much space they occupy, or it is 100% irrelevant and  should I just let them be?

I look forward to your reply, have a nice day.

I have encountered the same problem. I suspect my problems began when I attempted to push and existing repo into my brand new repo, with:
  $ git clone --bare {RepoURL}/{ExistingRepo}.git
  $ cd {ExistingRepo}.git
  $ git push --mirror {RepoURL}/{MyNewRepo}.git

I didn't understand at the time that the bare and mirror options resulted in copying all branches and commits from the original repo.  What I wanted was just the files from the latest commit.  I learned that this is best done by doing a filesystem copy of those files, carefully avoiding the ".git" directories.

At this point the extra branches are deleted, and the old commits are cleared from my local repo log, but the old commits persist in the BitBucket. For example, on m up-to-date local the command:
   $ git log HEAD..remotes/origin/master
returns zero commits, but the BitBucket UI displays hundreds of them.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

212 views 3 7
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you