1

I accidentally uploaded my bin, classpath, and a couple other files to my git which I had previously soft deleted. What command can I use to go through all my commits and delete certain files from my remote files only, not local.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Zach Sugano
  • 1,567
  • 5
  • 22
  • 41

1 Answers1

4

See the explanation on GitHub:

git filter-branch --index-filter 'git rm --cached --ignore-unmatch FILES' --prune-empty -- --all

With FILES being the files you want to nuke. Use -r if you want to delete whole directories.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • Is there a way to use the index-filter to modify files? .. or do you HAVE to use the tree-filter? – Adam Dymitruk May 28 '12 at 23:14
  • @AdamDymitruk: This seems to be pretty unrelated. Consider asking it as a new question. (No idea, I've never actually used the filter commands) – ThiefMaster May 28 '12 at 23:18
  • ok.. lol.. you answered pretty quickly for someone that never actually used the command ;) – Adam Dymitruk May 28 '12 at 23:19
  • 1
    See [this answer](http://stackoverflow.com/a/359759/720999) for an in-depth explanation of how `git filter-branch ...` works. – kostix May 29 '12 at 08:17