0

I am maintaining a Laravel project on heroku using git.

There is a folder public/assets/uploads which has jpg image files in it. So I have added public/assets/uploads/*.jpg to .gitignore.

As expected, any new files created in this folder is ignored while doing git push, but unexpectedly, it also removes my already existing .jpg files on the server.

I don't want any one to one correspondence between my local uploads/ folder and the uploads/ folder on the server. Local changes should stay local and online changes should stay online. I have been hittig my head for a long time searching on google and haven't found any solution.

Bhavik
  • 346
  • 4
  • 11
  • 1
    Possible duplicate of [git ignore exception](http://stackoverflow.com/questions/3203228/git-ignore-exception) – manniL Mar 25 '17 at 07:43
  • 1
    When a file is committed to a git repo, it is there until you explicitly remove it. Adding a .gitignore rule that matches the file won't remove the file from the repo. – Code-Apprentice Mar 25 '17 at 09:48
  • Also note that ignore rules affect the behavior of `git add`, not `git push`. – Code-Apprentice Mar 25 '17 at 09:54
  • There was a different problem than I thought. Actually when my project dyno will restart on heroku, any changes made online will be lost. So what @Code-Apprentice said is true – Bhavik May 10 '17 at 14:17

0 Answers0