-1

I just needed to post an answer so everyone will know it and also to save it for my future mistakes.

If anyone here knows better solution / tips / advices on this, please, elaborate! :)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Bruno Gelb
  • 5,322
  • 8
  • 35
  • 50
  • possible duplicate of [How to remove/delete a large file from commit history in Git repository?](http://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – Roberto Tyley Jun 19 '14 at 11:06

1 Answers1

0

Easy thing - you wont need to cut out commits, just do:

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD

It will delete all the file occurrences in history. You can mention $files as single file or as bunch of them.

Note that it will create backup, so you will need to use this command with -f option in case when you need to run it more than one time.

man: git-filter-branch(1) Manual Page

the idea belongs to The Nuclear Option: filter-branch

Bruno Gelb
  • 5,322
  • 8
  • 35
  • 50
  • 1
    Note that this option should be strongly avoided if you've got shared history. Also, if you've `push`ed **your passwords should be considered compromised and should all be changed**, even if you "go nuclear". – ChrisGPT was on strike Jun 19 '14 at 12:18