r/ProgrammerHumor • • Oct 10 '26

Meme noWayLol

Post image
11k Upvotes

118 comments sorted by

1.2k

u/eanat Oct 10 '26

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

364

u/fugogugo Oct 10 '26

any reason to exclude gitignore?

649

u/Successful-Active-21 Oct 10 '26

when everyone wants their own gitignore?

501

u/Blood_and_Wine Oct 10 '26 • Mindblown

My gitignore is better than yours gitignore

242

u/Abject-Kitchen3198 Oct 10 '26

My coworkers suggested I add * to mine and praised it as the best gitignore ever. Stopped all PR comments.

114

u/git_push_origin_prod Oct 10 '26

The best code, is no code at all

→ More replies (3)
→ More replies (2)

26

u/fugogugo Oct 10 '26

my gitignore is longer than your gitignore

13

u/git_push_origin_prod Oct 10 '26

You dropped these ..

18

u/ExtraWorldliness6916 Oct 10 '26

Mines so good, it's not here, you can't read it!

→ More replies (4)

39

u/No-Article-Particle Oct 10 '26

But one gitignore can't handle the 30-odd files that everyone wants to ignore... I never understood the "PR rejected, just ignore .swp files locally" tbh.

21

u/Loading_M_ Oct 10 '26

Yes and no. Git actually has a system wide gitignore you can setup to globally ignore files across your whole system. I personally take notes in a notes.md file, so I have a global ignore for it. I don't have you set it up for each repo, and it doesn't pollute the repo's gitignore. If your editor of choice creates temp files or stores project specific configuration in the project directory (e.g. .vscode, etc), they should also be in your global gitignore.

→ More replies (1)

14

u/NewLlama Oct 10 '26

Because it invites unbounded shared configuration for local workflows.

11

u/OhioGoblin43 Oct 10 '26 edited Oct 10 '26

Everyone hates me for being the repo gestapo but the only issues people have with setting up is when they've skipped steps in the doc. No one can be bothered to address that either though so it'll be me automating that too soon.

→ More replies (2)
→ More replies (1)

39

u/eclect0 Oct 10 '26

When would that be necessary?

Let me rephrase

In what situation could all contributors be trusted to maintain their own personal gitignore without any issues?

16

u/phl23 Oct 10 '26

If someone likes drama in his team, I guess.

4

u/Guest_User_1234 Oct 11 '26

This doesn't mean that this is the only gitignore. There's usually a project gitignore in any project I work on, and then I have my own, local, gitignore, for very specific things, like my own notes (like a TODO list) and local demo data

→ More replies (3)

5

u/subone Oct 10 '26

This isn't real, right? Git already supports ignores in the global config in your profile folder. I do this sometimes so I can add *.otr.md files to track detailed personal notes on individual project files and directories.

5

u/NerdyMcNerderson Oct 10 '26

Which is the exact use case for .git/info/exclude

2

u/FlorpCorp Oct 10 '26

But that's exactly what exclude is for lol

2

u/freemath Oct 11 '26

Surely you'd want a centralized point to list some files that you don't want to see in your remote? Like .venv or .env?

→ More replies (1)

23

u/SundaySloth_ Oct 11 '26

To hide that your gitignore is hiding AGENTS.md, CLAUDE.md, etcetera

22

u/Y0nix Oct 10 '26 edited Oct 10 '26

Some very specific CI pipelines. Or if using a big monorepo with hundreds of coworkers working on it.

You use that feature to ignore the main gitignore file and push the one you want into the pipeline. Because you may want to use a file that is normally being ignored for dev or commit to build your soft.

Like having a .env file for each purpose, but you don't wanna mess up with the way your builder is working for that one exception. And it's allowing everyone to have some flexibility to manage their own ignore rules.

7

u/anonymous4036 Oct 10 '26

If you have a file DatabaseFactory which you modify to provide a development database, you can add DatabaseFactory to the gitignore to avoid committing this change, but you then have a change to the gitignore so maybe this would work to avoid committing that change as well? I can think of a million ways this could go wrong though so idk.

3

u/Awkward_File0301 Oct 10 '26

In my experience Claude and Codex like to create a bunch of scripts or build files that I want to git ignore but they are specific to my context/task so I don't need to commit those changes to the git ignore

2

u/Lt_Duckweed Oct 11 '26

IMO the proper solution there is to discuss with the team, agree on a naming convention (copilotTemp or some such), and update the agent instructions so that the folder is utilized for things like that, and then add the folder to the .gitignore

1

u/NaturalTechnician737 Oct 11 '26

if .gitignore contains the line "path/to/SUPERSECRETKEY.psk", for example.

12

u/outwest88 Oct 10 '26

What’s it for? If you just want to temporarily disable gitignore or something?

26

u/thatashu Oct 10 '26

You want to gitignore something just for you. You don't want to add it to gitignore file.

For e.g. you have file context.md but much of it's is claude yap. You don't want everyone to see your claude written to file. But you want your clause to read it. So you exclude it.

8

u/cholz Oct 11 '26

why is everyone suggesting this but not suggesting using a user scoped ignore file in your .gitconfig

12

u/the_horse_gamer Oct 11 '26

.git/info/exclude is a user scoped ignore file

2

u/cleverboy00 Oct 11 '26

Build directories are a great example. Instead of hardcoding the output directory in your toplevel .gitignore, you make so that a .gitignore is generated in that directory, ignoring everything, including itself.

Meson is an example of a build system that does this.

74

u/JPowTheDayTrader Oct 11 '26

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.

400

u/NamelessJu Oct 10 '26

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 Oct 10 '26

git knows what to ignore by knowning what not to ignore.

56

u/No-Admin1684 Oct 10 '26

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 Oct 10 '26

Careful, that's how you end up with flowerpots and whales falling from the sky

→ More replies (1)

12

u/aschen15 Oct 10 '26

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

u/edwardbnd_99 Oct 10 '26

Yeah it's an interesting variant of the barber paradox

34

u/TeraFlint Oct 10 '26

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

u/NamelessJu Oct 10 '26

apparently you put the last sentence of my message into your .gitignore

11

u/No-Finance7526 Oct 10 '26

.brainignore

8

u/rosuav Oct 10 '26

It's also worth noting that an ignored file won't be excluded from the repo - it's just harder to accidentally commit it. I've had repos that gitignore "*" and then explicitly add the small number of files that I actually want to track.

68

u/Zap_plays09 Oct 10 '26

I unironically do this. The closest you are getting is a .gitignore.example file

11

u/benargee Oct 11 '26

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 Oct 10 '26

what will happen tho??

71

u/M4NU3L2311 Oct 10 '26

The universe collapses in on itself

15

u/x3knet Oct 10 '26

The modern divide by 0

4

u/SuperFLEB Oct 10 '26

...but you don't feel anything because it's gitignored.

45

u/Reashu Oct 10 '26

The file works as usual, preventing itself (and whatever else you put in it) from being tracked by git.

3

u/mcauthon2 Oct 10 '26

Can you then remove it? 

14

u/ZunoJ Oct 10 '26

It doesn't version the file but still uses it to ignore what is configured in it

12

u/eclect0 Oct 10 '26

The .gitignore file only affects you and everyone else can just commit whatever

3

u/beegtuna Oct 10 '26

This is what I’m committing

1

u/thanatica Oct 15 '26

Surely there's a better way to achieve this... A .gitignore in your user home folder or something?

1

u/autumnal-lights Oct 12 '26

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 Oct 11 '26

A gitignore that ignores itself is just a file that finally achieved inner peace.

10

u/Fckitman Oct 10 '26

I used stones to destroy the stones

16

u/_ironhearted_ Oct 10 '26

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 Oct 10 '26

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/Xexanos Oct 10 '26

TIL

This might actually be useful for my work

6

u/Firewolf06 Oct 10 '26

i have .local.gitignore as both a gitignore file and as an excluded file in my global git config, its quite nice

2

u/ozh Oct 11 '26

You have core.excludesfile=.local.gitignore ?

I have this, which works fine but I still have to add .local.ignore to the .local.gitignore...

1

u/Firewolf06 Oct 11 '26

i have that, plus .local.gitignore in ~/.config/git/ignore

→ More replies (1)

8

u/Noiapah Oct 10 '26

Wait it works recursively?

13

u/KeepScrolling52 Oct 10 '26

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

u/Noiapah Oct 10 '26

I suppose that makes sense. I know I just could google it, but it the spirit of vibecoding I am going to refrain from searching it up and just assume this is true on based vibes.

-5

u/road_laya Oct 11 '26

Incorrect. 

4

u/KeepScrolling52 Oct 11 '26

literally just tested it myself, I was right lmao.

2

u/Previous_Tangelo5414 Oct 10 '26

This will create a singularly that will tear a hole in the universe.

2

u/PokeRestock Oct 10 '26

How I felt when I deleted recycle bin on Windows Vista

2

u/Fantastic-Bloop Oct 13 '26

This made me laugh way harder than i should have

3

u/Possible_Row_2976 Oct 10 '26

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

u/Reashu Oct 10 '26 edited Oct 13 '26

There are better (or at least more idiomatic) ways to have a "local only" ignore file if that's what you want, but I've personally never had that need. 

2

u/G3nghisKang Oct 11 '26

Works like .gitignore but stays on your PC, can't think of any useful case

1

u/anonymouscoward142 Oct 16 '26

When you are a solo dev and dont want to leave any trace about the shit you are using, like AGENTS.md

1

u/e_asphyx Oct 10 '26

pkunzip.zip

1

u/JackNotOLantern Oct 11 '26

Not the best idea

1

u/rafisics Oct 11 '26

to my Overleaf projects :)

1

u/epsi22 Oct 11 '26

*
!.gitignore

1

u/XtraFlaminHotMachida Oct 11 '26

clone, checkout, then rm -rf .* that mf

1

u/poetic_dwarf Oct 11 '26

I used the Stones to destroy the Stones

1

u/Grandviewsurfer Oct 11 '26

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

u/Mobile-Positive-6742 Oct 12 '26

it works becoz gitignore is for local use. I did this sin before.

1

u/unpaid-philosopher Oct 13 '26

Stack overflow error

1

u/Jemnite Oct 15 '26

Finally, an actual joke on this subreddit. Haven't seen one for a while.

0

u/[deleted] Oct 10 '26

[deleted] — view deleted comment

0

u/[deleted] Oct 10 '26

[deleted] — view deleted comment

1

u/javascript_old Oct 11 '26

i not commit node modules