Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Some common .gitignore configurations
# Compiled source #
# Packages #
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
# Logs and databases #
# OS generated files #

turtledb commented Apr 9, 2014

GIT with it

blue-ice commented May 1, 2014

Thanks, Octocat!

shacker commented May 10, 2014

*.pyc would be a good addition here.

So convenient! Thanks Octocat!

Useful stuff, thanks!

Tatsh commented May 29, 2014

*.pyo and *.pyc and *~ (backup files generated by text editors)

even *.bak & *.swp as well can be added

infn8 commented Jun 10, 2014

Of course GitHub would give their logo an account. Awesome

It's good, thanks. But how to ignore some directories, such as target, out, production?

Great resource - many thanks for sharing.

Some examples with directories per suggestion would help round out this already excellent tip

Thank you for this great contribution!

Thanks used this a number of times on projects

I think .dll files are important if you're developing with .NET.

Also, you could include .ai, .eps, and .psd on it.

Thanks, for the great snippet.

nice! you should add sass-cache folder too ;)


ghost commented Sep 1, 2014


awesome document. thanks.

zpetr commented Sep 9, 2014

Hi, I added some IDE files (of NetBeans, Eclipse and Zend Studio) to ignore. Look at:

Kafei59 commented Sep 24, 2014

Surely, *~ and *# for emacs users

Very helpful. Thanks

jjsub commented Oct 8, 2014

How I can ignore a specific directory ?

very helpful :)

Thanks Octocat !


Helpful ๐Ÿ‘

.iml :)

Add these to exclude media extensions:










nojacko commented Nov 28, 2014

This gist is pretty much defunct by

.orig files generated by git diff

AngAven commented Dec 27, 2014

I love .gitignore thank you

Some windows files too;


To ignore backup files generated by text editor anywhere in the subdirectory


To ignore IDE (eclipse / intellij) related files


And What about Iconr?

This is very helpful. Thanks guys

@arulrajnet @cptstarling it is not recommended to ignore entire .idea directory. Instead we should add only the two lines below to local .gitignore file:


This way all good project configuration (for example Code Style, namespaces mapping, etc) will be shared among all team.

ILM126 commented Feb 15, 2015

Good! Now I can git on with my work ^^

Thanks that really helped

omidfi commented Apr 30, 2015

What if I want to ignore all .txt files, but one? For example all the txt files out, but keep important.txt ?

*.log isn't working for me. I have the logs 'server.log', 'connected.log', and 'visitorcount.log' in a folder named 'logs', and GitHub Desktop keeps asking me to commit the files whenever they are modified.

I'm using Notepad to add these updates and have rebooted GitHub Desktop. Is there any weird technical feature that I am missing?

for vim users


JacobWay commented Jun 3, 2015

Thanks, add to my file, and add npm install modules directory

Thanks man.

istro commented Jun 12, 2015

๐Ÿ˜˜ :octocat:

vpope commented Jun 18, 2015


Wonderful, yo~

for vim

Here's a more robust version of the vim ignores for your global .gitignore:


Thank you . Quite a useful example.

It is strange that no one mentioned - web ui to

Devnco commented Sep 13, 2015

Thanks ๐Ÿ‘

@hppavilion1 you should add **/ prefix. It'll include all subfolders as well.



Should *.sql really be ignored? I've seen instances where raw migrations are saved in .sql format and would be important to commit.

StenHigh commented Oct 1, 2015


does adding .gitignore inside the .gitignore file affect anything generally?

marnen commented Oct 27, 2015

\#*\# would also be worth adding.

And *.sublime-workspace for those who use SublimeText. It's important not adding these files, for security reasons.

And I agree with @ScottyMJacobson, *.sql files are important for some projects, I'm used to adding the initial version of the database this way. Suits me well... any advices?

  • .gitignore to default list.

vim swapfiles (*.swp) should be added as those do not belong into a repository

thanks so much

thanks , nice work!!

ealgase commented Jul 9, 2016

Very useful!


ghost commented Jul 27, 2016

Neat! Thanks.

Huge help, thanks.

Thank you.

vinyll commented Sep 21, 2016

# OS generated files #

Should be located in ~/.gitignore

joeblau commented Oct 12, 2016

Here is a project I'm maintaining for gitignore templates -

zillem commented Nov 22, 2016

I'd add *.msi to my package section.
But thanks Octocat! much easier than finding them myself.

JulieH2016 commented Dec 13, 2016

Might want to add this specific file example (keys.js) into your .gitignore file if you are using API keys to keep that info private and not copied.

Thanks a lot Octocat!

WeSpeakEnglish commented Jan 27, 2017

Thank you for your helpful work!

Really handy, thanks!

Thank you for this great contribution! i use it every time ๐Ÿ‘

Narven commented Apr 19, 2017



where to put this in case of GitHub Desctop App on windows system?

.pyc also

Very useful and handy. Thanks a lot

This is so useful!! Thank you

A note on .sqlite:
Currently, on a fresh Django installation, the default database name is db.sqlite3, so maybe .sqlite3 should be in here as well?

desktop.ini not listed ๐Ÿ˜ฎ

well done

Gittin' jiggy wid it.

We should also add target folder in .gitignore , which is generated by maven as build outcome along with packaged files, as:

Global git ignores seem to be quite improper when a person is using git-annex. I first experienced this a couple of years ago: umeboshi2/dotfiles@49292a1

Today, while trying to update the git-annex repo for I found a few more. Please add some language that qualifiy the suggestions from github to allow for the addition of certain "ignores" that may need to be tracked above git, yet still be under the constraints of the ignore file.

In all honesty, the suggestions from this gist, with respect to the config being global, and also the use of git-annex, has eliminated many of your suggestions. Even my opinion on *~ wasn't met by My ignore file is here:

Please understand that I was actually surprised by a "filename~" existing on the mirror and had to really .think about the ignore file. That was not your suggestion, but I was surprised anyway.

My purpose for the comment is to encourage github to provide some sort of "disclaimer" that these files may not need to be ignored.

It's very possible that git-annex may want to "ignore" the global ignores and have it's own global ignore file and not respect the global git ignore config. I will try to bring that point across to Mr. Hess if able.

elesos commented Feb 2, 2018


Please also add *.apk to it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment