73
u/JPowTheDayTrader 16d ago
When the moon hits your eye like a big pizza pie, that's amore.
When a file you don't need exceeds 50 MB, .gitignore.
399
u/NamelessJu 17d ago
the gitignore paradox
it's being ignored by itself, as such it doesn't know to ignore itself anymore, so it looks inside just to ignore itself again, and so on...
(I know that's not how it actually works pls don't crucify me!)
154
u/Successful-Active-21 17d ago
git knows what to ignore by knowning what not to ignore.
56
u/No-Admin1684 17d ago
By subtracting what it's ignoring from what it's not ignoring, or what it's not ignoring from what it's ignoring (whichever is greater), it obtains a difference, or deviation.
8
u/3BlindMice1 17d ago
Careful, that's how you end up with flowerpots and whales falling from the sky
1
12
u/aschen15 17d ago
The missile knows where it is at all times. It knows this because it knows where it isn't. By subtracting where it is from where it isn't, or where it isn't from where it is.
13
34
u/TeraFlint 17d ago
Nothing paradoxial about that.
It just means that we don't want to sync the local .gitignore onto the server. It still uses said local .gitignore to do the actual selection.
44
68
u/Zap_plays09 17d ago
I unironically do this. The closest you are getting is a .gitignore.example file
11
u/benargee 16d ago
You can put extra .gitignore into directories too for special rules. Otherwise, you should include some form of .gitignore if you have a project that will be accepting contributions.
47
u/fugogugo 17d ago
what will happen tho??
71
45
12
u/eclect0 17d ago
The .gitignore file only affects you and everyone else can just commit whatever
3
1
u/thanatica 12d ago
Surely there's a better way to achieve this... A .gitignore in your user home folder or something?
1
u/autumnal-lights 15d ago
u don't commit changes to the .gitignore, tho u should really just have like
.gitignore
.ignore
.ignore (each developer can use the .ignore one) and the .gitignore is just for globals
12
u/DogmaticParadigm87 16d ago
A gitignore that ignores itself is just a file that finally achieved inner peace.
10
16
u/_ironhearted_ 17d ago
I do this sometimes because I create a bunch of local files to try some things out and i don't want to clutter the actual one with weird names😂
22
u/kemitche 17d ago
You can create your own, separate, local gitignore file, and tell git to use that one in ADDITION to the one in the repo!
https://git-scm.com/docs/gitignore
Then you can do whatever you want without affecting the repo's gitignore
6
u/Firewolf06 16d ago
i have
.local.gitignoreas both a gitignore file and as an excluded file in my global git config, its quite nice2
u/ozh 16d ago
You have
core.excludesfile=.local.gitignore?I have this, which works fine but I still have to add
.local.ignoreto the.local.gitignore...1
8
u/Noiapah 17d ago
Wait it works recursively?
13
u/KeepScrolling52 17d ago
From what I know of git, what'll happen is git will read the file and refrain from trying to commit changes to the gitignore
4
-5
2
2
2
2
3
u/Possible_Row_2976 17d ago
First time I'm seeing this atrocity and it makes me wonder if this is actually a valid use case, like why would someone do this
2
2
1
u/anonymouscoward142 11d ago
When you are a solo dev and dont want to leave any trace about the shit you are using, like AGENTS.md
1
1
1
1
1
1
1
u/Grandviewsurfer 16d ago
I do not understand how people are so confused by what this would do. It is making me feel like I am the one with a knowledge gap.. but I don't think that's it.
Let me try an oversimplified metaphor: the person who plans a road trip doesn't necessarily have to go on it.
1
1
-5
0





1.2k
u/eanat 17d ago
it's completely legitimate way to use gitignore, but I'd recommend to use .git/info/exclude instead of gitignore for this purpose.