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

How to delete commits forever from bitbucket?

Tamás Horváth August 31, 2014

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

1 vote
Answer accepted
AgentSmith
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 2, 2014
Arcanum Scriber March 18, 2018

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.

Like # people like this
David Hentchel October 5, 2018

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.

Deleted user November 19, 2018

Hi @AgentSmith,

I second the question from Dávid Magyar as I noticed the same on BitBucket Self-Hosted on our side. I'm a bit concerned about this. Suppose you commit something sensitive in a commit and you'd like to get rid of it forever.

Although I actually "deleted" the commit through git, when I push the branch ( with --force or --force-with-lease ) the commit on the PR status is flagged as deleted, but if I click on the hash of the deleted commit, I can see the commit itself. Looks like to me that the hash is not really deleted on the repository then.

Suppose some malicious actor gets control of our Self-Hosted instance, can potentially scrape for this information and cause some harm.

What is your team related to Security doing about this? Is there something we can do about as well?

Thank you in advance,
Julian

Like # people like this
alelts April 22, 2020

@AgentSmith having the same problem here.

Can't see the offending commit in the history but if I just navigate to the commit url in Bitbucket I can still see the commit itself.

Any insights?

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events