My personal .gitignore file

github

Lesson learned

After doing this file many times, I decided to build my personal .gitignore file; I use to add it in my very fist commit as a good practice in every single git repository I create.

Currently we are ignoring:

  • Operating systems’ temporary files: Mac OS X, GNU/Linux, Windows.
  • IDEs and editors’ configuration: Vim, Sublime Text, Notepad++, Eclipse, Netbeans, Xcode, IntelliJIDEA.
  • Other Control Version Systems: CVS, SVN

More information about ignoring files: https://help.github.com/articles/ignoring-files

Note: if you want to create your own configuration in your .gitignore you could use: http://www.gitignore.io/

How to integrate this file into my project

  • Download or copy following file/content in the root directory of your project with the name .gitignore (gitignore.txt)
  • If you download gitignore.txt file, please rename it to .gitignore

    Common issue: “OS X doesn’t let me to rename my gitignore.txt to .gitignore”:

    “You can’t use a name that begins with a dot “.”, because these names are reserved for the system. Please choose another name”.

    A workaround for this is to:

    1. Open the terminal
    2. cd to the directory with gitignore.txt and run the following command
    3. mv gitignore.txt .gitignore
  • Add .gitignore file to your repository (git add)
  • Commit (git commit)
  • Upload your commit to remote server (git push)

REMEMBER!

Once Git starts to watch/track any file, for example hello.txt in the repository, it is NOT possible to say “Hey git! now, ignore my file hello.txt“. Unless you read this post: How to force Git to “ignore” tracked files.

# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
# Improved by Alex Arriaga (@alex_arriaga_m) - http://www.alex-arriaga.com
 
# Include your project-specific ignores in this section
# ----- Project ignores
 

bower_components
node_modules
.idea

 
 
# ----- Operating Systems
# OS X
# https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
.DS_Store
.AppleDouble
.LSOverride
# Icon must ends with two \r.
Icon
 
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
 
 
# GNU/Linux
# https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
*~
!.gitignore
#*~
 
# KDE directory preferences
.directory
 
 
# Windows
# https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows image file caches
Thumbs.db
ehthumbs.db
 
# Folder config file
Desktop.ini
 
# Recycle Bin used on file shares
$RECYCLE.BIN/
 
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
 
 
 
#  ----- Other Control Version Systems
# SVN
# https://github.com/github/gitignore/blob/master/Global/SVN.gitignore
.svn/
 
# CVS
# https://github.com/github/gitignore/blob/master/Global/CVS.gitignore
/CVS/*
*/CVS/*
.cvsignore
*/.cvsignore
 
 
 
 
#  ----- IDEs and editors
# VIM
# https://github.com/github/gitignore/blob/master/Global/vim.gitignore
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
# *~
 
 
# Sublime Text
# https://github.com/github/gitignore/blob/master/Global/SublimeText.gitignore
# workspace files are user-specific
*.sublime-workspace
 
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
 
 
# Notepad++
# https://github.com/github/gitignore/blob/master/Global/NotepadPP.gitignore
# Notepad++ backups #
*.bak
 
 
# Eclipse
# https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
#*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
 
# External tool builders
.externalToolBuilders/
 
# Locally stored "Eclipse launch configurations"
*.launch
 
# CDT-specific
.cproject
 
# PDT-specific
.buildpath
 
# sbteclipse plugin 
.target
 
# TeXlipse plugin
.texlipse
 
 
# Netbeans
# https://github.com/github/gitignore/blob/master/Global/NetBeans.gitignore
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
 
 
# Xcode
# https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
# build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa

# IDEA
.idea

Hope you find this .gitignore useful, see you next time!

Leave a Reply

Your email address will not be published. Required fields are marked *