I am working on PhpStorm. There are some files/folders that I would like git to ignore. These are on the remote repository, too. I just don't want to reflect any more changes about them but they have to stay - not be deleted - from remote repo since I am going to pull from this repo to the production server.
git rm -r --cached .idea/
I did this and related files/folders were deleted from my remote repository too, which I don't want because I think it will result in deleting those when I pull on the production server.git update-index --assume-unchanged .idea/
I did this, "Ignoring path .idea/" was written in the terminal, I hoped that it would work but when I wanted to commit, I saw that folder again as tracked.What am I doing wrong?
Note: .idea folder may not be important for the production server, but there are some important folders needed for the code to run.
I discovered where I was wrong. For those who may need, I will explain it with two folders I have:
So:
git update-index --skip-worktree config/
Running this and changing config.php didn't help. On the other hand:
git update-index --skip-worktree pdf/
After running this I got a pdf output from my web application and it created pdf.html also under pdf/ folder. So, this new file was ignored, good.
Shortly, I concluded that I had to point out the exact file if that's what I want to be ignored, like this:
git update-index --skip-worktree config/config.php
It ignores any changes to this file afterwards.
(I tried the same with --assume-unchanged
, it worked, yet since I have understood the difference very well from the answer above, I wanted to highlight the better way here)