Sometimes, you will want to ignore files from your git commits and pushes. For example, I had a file that stored some database information on my local machine/staging server, but the same database information doesn’t apply to my production environment.
git comes with a file called .gitignore that allows you to ignore any files during a commit or push. The .gitignore file will need to be in the top level of your working directory, and just needs to include the filename that you don’t want to use.
There is also another file located in /.git/info/exclude that you can include your files to ignore. Mac OSX has a hidden file in all directories called .DS_Store, so the below exclude file is an example that you can use:
# git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ .DS_Store