简体   繁体   中英

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. Neither 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM