Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.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

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 https://gist.github.com/ThomsonTang 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

ghost commented Sep 1, 2014

Awesome.

awesome document. thanks.

zpetr commented Sep 9, 2014

Hi, I added some IDE files (of NetBeans, Eclipse and Zend Studio) to ignore. Look at:
https://gist.github.com/zpetr/e783d537f8a40bb6ec16

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 !

tags

Helpful πŸ‘

.iml :)

Add these to exclude media extensions:

Images

*.jpg
*.gif
*.png
*.svg
*.ico

Video

*.wmv
*.mpg
*.mpeg
*.mp4
*.mov
*.flv
*.avi
*.ogv
*.ogg
*.webm

Audio

*.wav
*.mp3
*.wma

Fonts

*.eot
*.ttf
*.woff

.idea
(PHPStorm)

nojacko commented Nov 28, 2014

This gist is pretty much defunct by https://github.com/github/gitignore

.orig files generated by git diff

AngAven commented Dec 27, 2014

I love .gitignore thank you

Some windows files too;

Thumbs.db
desktop.ini

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

**/*~

To ignore IDE (eclipse / intellij) related files

.classpath
.project
.settings
.idea
.metadata
*.iml
*.ipr

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:

/.idea/workspace.xml
/.idea/tasks.xml

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

*.swp
*.swo

JacobWay commented Jun 3, 2015

Thanks, add to my file, and add npm install modules directory
/node_modules/*

Thanks man.

istro commented Jun 12, 2015

😘 :octocat:

vpope commented Jun 18, 2015

πŸ‘

Wonderful, yo~

for vim
*.un~

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

**/*~
**/*.bak
**/*.sw[abcdefghijklmnop]

Thank you . Quite a useful example.

It is strange that no one mentioned http://www.gitignore.io - web ui to https://github.com/github/gitignore

Devnco commented Sep 13, 2015

Thanks πŸ‘

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

ex:

**/*.log*

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

*.png
*.jpg
*.jpeg
*.gif
*.bmp
*.svg
*.ico
*.psd

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

ghost commented Jul 27, 2016

Neat! Thanks.

Huge help, thanks.

Thank you.

vinyll commented Sep 21, 2016

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

Should be located in ~/.gitignore

joeblau commented Oct 12, 2016

Here is a project I'm maintaining for gitignore templates - https://www.gitignore.io

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 edited

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 edited

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

.vscode

++++

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

.pyc also

Very useful and handy. Thanks a lot

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