Untrack folder locally in git and push to production without deleting
With git rm --cached
, the files are removed from git, though they're still in your local folder. So after you push
, the files on sever will be deleted, and so do others' repository when they pull
.
A better way is to use git update-index
.
git update-index --assume-unchanged images/*
It should fulfill your requirement. The only problem is that if others' change these image files and push to git server, you will still get these changes when you pull
.