I was testing how to work with git/bitbucket. And I uploaded a file that I should not. Now I removed it, but it still able to be seen in history. How may I delete it completely ?
Asked
Active
Viewed 39 times
0
-
Do you mean some kind of history visible on the Bitbucket web user interface? – Nayuki Jun 08 '15 at 02:53
2 Answers
1
Looks like the answer you are looking for is covered here
The tool you want is git filter-branch. Its usage is described here, but basically:
$ git filter-branch --tree-filter 'rm -f my_file' HEAD will remove "my_file" from every commit.
Notice that this rewrites every commit, so if you push into a remote repository, you have to (a) force the update, and (b) everyone else who pulled from you will now have duplicate commits (since you rewrote the history), as described on the git rebase man page.
-1
git reset --hard (find the sha1 of your first commit)
and then force push:
git push -f
I'm pretty much rewriting the entire history of whatever branch you're pushing to.
source here

Community
- 1
- 1

PlayHardGoPro
- 2,791
- 10
- 51
- 90
-
With this command you will also loose all the commits after the `sha1` you have found. I think this not what you want to achieve. Instead, stick to the solution provided by @Christian – ckruczek Jun 08 '15 at 04:55