简体   繁体   中英

Does git rm --cached remove production files?

Some image files came up when I ran git status :

modified: public/system/styles/dimages/000/000/003/medium/m312.png

I don't want to commit images from my development environment, so I tried adding public/system/styles/dimages/ to my .gitignore

I ran git status again and saw the same image files so I ran:

git rm --cached -r public/system/styles/dimages/

What I saw next scared me, because it looks like a whole bunch of images from my production server were removed:

rm 'public/system/styles/dimages/000/000/001/medium/iniga.jpg'
rm 'public/system/styles/dimages/000/000/001/original/iniga.jpg'
rm 'public/system/styles/dimages/000/000/001/thumb/iniga.jpg'

I am wondering if I have messed anything up by running git rm and whether pushing/deploying my code will remove any of the image files on my production server.

Thanks very much

git rm --cached is intended to remove any files that were previously checked in up until that point, so if the image files were checked in, then there would be an issue with their disappearance from the repository.

Given that it seems that those files are required for your application, I hate to say it but you can't just blanket remove them like that. Not until you can safely get them moved to another server somewhere else, and have your application depend on that server for those resources.

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