I have a website under version control using GIT. I have a system set up that essentially, automatically deploys changes in my master
branch to my production server. Namely, I have a web-hook in my repository that triggers a PHP script that essentially initiates a git pull
on the server in order to pull down changes.
My issue lies in the fact that I currently have a configuration file (config.php
) that is tracked using git. Myself and another developer want to have our own config.php
files that are different to the file on the server, therefore we want to tell git to stop tracking this file and just pretend it isn't there.
We decided first to test using a less important file, so we added test.php
to our .gitignore
file, hoping this would do the trick. Git was still tracking the file so I tried running git rm --cached test.php
in an attempt to stop tracking the file. This seemed to work so we committed and pushed our changes.
To my surprise, when our deployment script initiated the pull on our server we found that this file had been deleted from production. Thanksfully, the deleted test.php
was not important.
TLDR; How can I tell git to ignore a file it currently tracks, have it untracked and deleted from my repository, but leave it intact on my production server?