34

I have a Ruby on Rails application which crashes when vendor/rails is present but works fine if it is not. I need to keep this folder deleted in my local copy so that I can work, but I don't want this deletion to ever be committed. Someone put it there for a reason.

So how do I delete this folder without it coming up in git status as a thousand deleted files? Obviously .gitignore won't work since you can't ignore files which are already tracked. Neither do any of the solutions listed here (git update-index --assume-unchanged) work.

Community
  • 1
  • 1
Alexander Ljungberg
  • 6,302
  • 4
  • 31
  • 37

1 Answers1

82
 git ls-files --deleted -z | git update-index --assume-unchanged -z --stdin

Note that because this is an index-based operation, you cannot set directories to be ignored – only individual files. If upstream ever adds a file inside those directories, you will have to repeat the fix-up.

Aristotle Pagaltzis
  • 112,955
  • 23
  • 98
  • 97