Git Ignore File


Some times we don't want to commit few files to repository. Then what we can do Now.

To hanlde this we have one option in git, is ignore file

We can set git to ignore some files, such as emacs backup files, compiled files.

Each git project dir top level should have a ignore file file named .gitignore

~/git/projectX

.git

.gitignore

README.md

projectX.py

Purpose of Git Ignore File

.gitignore file contains file name patterns that git should ignore.

Sample Git Ignore File

Here's a sample content of git ignore file:

#-------------------

# emacs

*~ *.elc

[#]*[#] #-------------------

# compiled files

*.com *.class *.dll *.exe *.o *.so

#------------------- # packed files

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

 

For detail, type in terminal git help gitignore