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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

1 vote
Answer accepted
AgentSmith 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.

Like # people like this

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.

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

@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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,154 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you