I've made a wrong commit and I pushed it to my private bitbucket.org repository. How can I completely remove this commit from remote repository's history?
I tried the following:
git reset --hard HEAD~1
git reset HEAD~
git commit -m "some message"
git push -f
I did this based on solution from Bitbucket git reset
Yet, previous commits are accessible via Bitbucket's web interface.
I mean they are still accessible using a link like https://bitbucket.org/user/repo/commits/<deleted commit hash> (although they are not listed in repository commits in web interface).
Is this information (the history which I intended to delete) fetched from my repository ?
Or
- Is this some feature of bitbucket.org?
- Did I take some step(s) wrong? Which?
- How to completely remove a commit from history on bitbucket.org ?
You can achieve that by dropping the commit and force pushing the updated branch to your remote. Note: careful if other persons have checkout the branch.
Supposing your history is like the following and you want to delete commit 200:
commit 300
commit 200
commit 100
Do the following:
git rebase -i HEAD~3
Now, delete the line of commit 200.
Save the file, and then force push the branch to the remote:
git push -f origin <branch_name>
来源:https://stackoverflow.com/questions/25874104/completely-remove-commit-from-bitbucket-history