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

Remove Orphaned Commits From History

Nathan McLean May 17, 2017

I deleted a branch that was accidentally pushed to my bitbucket repo. After deleting the branches using `git push origin --delete BRANCH_NAME`, commits from the branch still show up in the BitBucket web UI under the commit history for "all branches". I would like to clean up the history so that these commits, which are no longer part of any branch, are not displayed.

The commits no longer appear to be part of the git repository (e.g. if I try to use `git show COMMIT_HASH` I get a "bad object" error, indicating no commit exists with that hash, yet these commits still show up in the Web UI)

Is this possible to purge these commits such that they no longer appear in BitBucket?

2 answers

1 accepted

0 votes
Answer accepted
Nathan McLean May 19, 2017

The branch wasn't showing up when I pulled the repo locally, but when I used "git ls-remote" I was able to see the remote branch and delete it.

0 votes
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2017

Try running garbage collector 

git gc --aggressive --prune=now

 

Nathan McLean May 17, 2017

This does not appear to be a problem in my local git repository, it only appears to be a problem in the BitBucket web UI. How would I push removal of commits to the origin repo?

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events