HOW-TO: Create a global git ignore file

Git Logo

If you work on web projects day in and day out, you might want to make sure pesky cruft files don't get accidentally commited when you push code upstream.

A great way to achieve this goal is to create a global git ignore file. To do this, first configure git to read this global git ignore file (you can name it what you want)

$ git config --global core.excludesfile ~/.gitignore_global

Then edit the ~/.gitignore_global file and add a few ignore lines:

$ vim ~/.gitignore_global

Here's what I recommend:

# Packages 

*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases

*.log
*.sql
*.sqlite

# OS generated files

.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Ignore configuration files that may contain sensitive information.
sites/*/*settings*.php

# Ignore paths that contain generated content.

files/
sites/*/files
sites/*/private

# Ignore default text files
robots.txt
/CHANGELOG.txt
/COPYRIGHT.txt
/INSTALL*.txt
/LICENSE.txt
/MAINTAINERS.txt
/UPGRADE.txt
/README.txt
sites/all/README.txt
sites/all/modules/README.txt
sites/all/themes/README.txt

# Ignore everything but the "sites" folder ( for non core developer )
#.htaccess
#web.config
#authorize.php
#cron.php
#index.php
#install.php
#update.php
#xmlrpc.php
#/includes
#/misc
#/modules
#/profiles
#/scripts
#/themes

 

Rob Montero

Rob Montero, Drupal Association Individual Member

Roberto Montero Ortiz is an individual member of the Drupal Association, which fosters and supports the Drupal software project, the community and its growth. He also has an active role in the Drupal Community in Costa Rica and regularly contributes to Drupal Camps held in Latin America.

Rob Montero, Acquia Certified Developer 2014   Rob Montero, Certified Developer Back End Specialist 2015Rob Montero, Acquia Certified Developer Front End Specialist

Rob is also an Acquia Certified Developer, awarded with the Grand Masters title after completing his third certification within a year. 

Zend also certifies Rob's knowledge of PHP OOP skills, but at this point this block is getting a bit presumptious. Suffice it to say, Rob is competitive and competent. He's also a nice guy all around.

Drupal Latin America

Rob Montero is a proud sponsor and mentor of young Drupal talent of the Costa Rican Drupal Users Group and entrepreneur at Drupal Latin America

CHECK THEM OUT

Get in touch

  • Rob Montero
    Ave Popocatepetl 435 B 504
    Sta Cruz Atoyac, Benito Juarez
    Ciudad de México, 03310 
  • (858) 952 0762
  • roberto@montero-ortiz.com
Signup to our newsletter:
Error | Roberto Montero

Error

The website encountered an unexpected error. Please try again later.