Git .gitignore Usage

Comments discuss features, configuration, global usage, and best practices for .gitignore files in Git, including tool integration and common pitfalls.

➡️ Stable 0.6x DevOps & Infrastructure
2,011
Comments
20
Years Active
5
Top Authors
#1776
Topic ID

Activity Over Time

2007
2
2008
9
2009
22
2010
20
2011
41
2012
52
2013
86
2014
77
2015
71
2016
131
2017
83
2018
76
2019
80
2020
173
2021
102
2022
278
2023
206
2024
222
2025
270
2026
10

Keywords

SOURCE e.g IMO CONTRIBUTING.md stackoverflow.com example.com TREE foo.inc github.com travis.yml git ignore files directories file project url ignores whitelist config

Sample Comments

jdironman • Feb 14, 2025 • View on HN

Something I didn't dig to find, but is it possible for these applications to also respect .gitignores? Might be a handy flag!

angelbob • Sep 23, 2011 • View on HN

Nice! I remember being surprised that .gitignore didn't do this.

einpoklum • May 18, 2022 • View on HN

How much ignore would a git gitignore ignore if that gitignore was a git?

catlifeonmars • Jun 26, 2021 • View on HN

Nice! Is there a way to check this into a repository (a la .gitigore)?

jsilence • Apr 11, 2020 • View on HN

It would be nice if it would have a .gitignore like ignore file. Or does it?

JoBrad • Nov 24, 2024 • View on HN

In my experience .gitignore files are often overloaded, so would provide false positives.

nyanpasu64 • Jun 26, 2020 • View on HN

Adding to `~/.gitignore` is not enough. You need to tell Git to use it via `git config --global core.excludesfile ~/.gitignore` or similar.

Fatnino • May 18, 2022 • View on HN

.git/info/exclude seems like the right place for this.

atrilumen • Oct 1, 2015 • View on HN

For source code repos, yeah. Otherwise, add .DS_Store to your .gitignore.

graywh • Jun 10, 2019 • View on HN

my .gitignore is set to ignore everything with a wildcard and un-ignore a few hidden directories where i'm likely to place new files (e.g., .vim, .zsh)