March 2018

Ignoring Files on a Local Repository

We maintain maintain many websites on the Pantheon Platform.  One of the things that we must do when creating local repositories is create a settings.local.php file for storing our local credentials so this information is not shared, nor does it break the site when you bring it down and push it back up.  I wish to not have git continually asking if I wish to track this file and I do not wish to take a chance of commiting it accidentally so, with help, I was told of this method to ignore the file locally and not have that addition to .gitignore not conflict or interfere elsewhere.

In short this method allows the system to ignore certain files in your local repository (that are not to be a part of the git branch or that are not to be propogated). 

The .git/ directory gets created when you create/clone a git repo.  Inside that directory you will find a file .git/info/exclude.  This file acts like a personal .gitignore that allows you to specify files you want git to ignore and not stage.