Kareem Mohamed
Kareem Mohamed

Reputation: 251

git ignore files without deleting remotely

I have an images folder I want to untrack any changes on my local machine but not remove it remotely every time I push to heroku.

I added it to .gitignore and ran git rm --cached images_folder -r but now every time I push to herkou it gets deleted

Any ideas?

Upvotes: 1

Views: 404

Answers (1)

gravetii
gravetii

Reputation: 9624

Try git update-index --assume-unchanged <path to images folder>.

This will ask git to temporarily disallow tracking that file. Any changes you make to that file will be ignored by git. When you want to track the changes to the file again, you can do git update-index --no-assume-unchanged <path to images folder> which will start tracking the changes back again.

Upvotes: 1

Related Questions