Let’s say you need to setup a new Drupal DEV Site. After pulling all the files you need to configure your settings.php to connect to your database. Now git knows you have changed something.
You don’t want to push your credential into git, you always keep it private. So we need tell git not to detect changes in our settings.php.
git update-index --no-assume-unchanged <file>
In our case we need to specify settings.php path
git update-index --no-assume-unchanged sites/default/settings.php
That will tell git to ignore anything we change or update into settings.php.
Another way can do (not related to detecting files) is to prevent any push from the server to our git repo. To do that we need to tell git to disable pushing to origin.
git remote set-url --push origin no_push
This two lines of code helped today. I hope this will help you too. Chow~!!!~