Git ignore locally deleted folder
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. Nei开发者_StackOverflowther do any of the solutions listed here (git update-index --assume-unchanged
) work.
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.
精彩评论