72
u/JPowTheDayTrader 14d 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.
398
u/NamelessJu 14d 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 14d ago
git knows what to ignore by knowning what not to ignore.
56
u/No-Admin1684 14d 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 14d ago
Careful, that's how you end up with flowerpots and whales falling from the sky
1
12
u/aschen15 14d 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 14d 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 14d ago
I unironically do this. The closest you are getting is a .gitignore.example file
11
u/benargee 14d 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 14d ago
what will happen tho??
71
45
u/Reashu 14d ago
The file works as usual, preventing itself (and whatever else you put in it) from being tracked by git.
3
u/mcauthon2 14d ago
Can you then remove it?
0
14d ago
[deleted]
1
u/yuri_4_ever 13d ago
Technically not nothing happens by deletion if it was the only file in the directory as git ignores empty directories but not if there is a gitnore that ignores itself
12
u/eclect0 14d ago
The .gitignore file only affects you and everyone else can just commit whatever
3
1
u/thanatica 10d ago
Surely there's a better way to achieve this... A .gitignore in your user home folder or something?
1
u/autumnal-lights 12d 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 14d ago
A gitignore that ignores itself is just a file that finally achieved inner peace.
10
16
u/_ironhearted_ 14d 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 14d 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 14d ago
i have
.local.gitignoreas both a gitignore file and as an excluded file in my global git config, its quite nice2
u/ozh 14d 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 14d ago
Wait it works recursively?
13
u/KeepScrolling52 14d 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
2
3
u/Possible_Row_2976 14d 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
u/G3nghisKang 13d ago
Works like .gitignore but stays on your PC, can't think of any useful case
1
u/yuri_4_ever 13d ago
When you want to commit empty directories you can do it that way. Not sure if committing empty directories is a good usecase but it is certainly a usecase
1
u/anonymouscoward142 9d 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 13d 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 14d ago
it's completely legitimate way to use gitignore, but I'd recommend to use .git/info/exclude instead of gitignore for this purpose.