I prefer to flip the logic of the .gitignore.

# ignore root files/folders
/*

# unignore files
!.gitignore
!README.md
!Justfile
!flake.nix
!flake.lock
!pyproject.toml
!.python-version
!uv.lock

# unignore folders
!src/
!docs/

# reignore (recursively)
__pycache__

This includes the files and folders (and their subfiles/folders), while recursively ignoring any pycache bullshit.

  • Small
  • Maintainable
  • Easy to change
  • Readable

I like this solution a lot. I hope I remember it the next time I initialize a repository.

Yes, I believe this was made for MacOS users. I don't need to see your .DS_Store files!

Yes. If there's ever a truly epic Mac zero day, I have faith that whoever finds it will use it to add .DS_Store to every Mac's global .gitignore.

I seriously doubt the guys who were selling Pegasus don't have anything for a platform that has so many hardware level expoits like

https://thehackernews.com/2025/01/new-slap-flop-attacks-expose-apple-m.html

https://www.ibm.com/think/news/apple-m-series-chips-hardware-flaw

or that it will be used for anything besides abusing human rights...

Man, what a stupid idea .DS_Store was.

thumbs.db FTW!

Or for Dolphin users.

Wow that is really blue, checks background color:

--body-background: blue;

I'm surprised it wasn't reallyblue

There's also .git/info/exclude, which is a per-repo local (untracked) .gitignore.

You can even add more ignore files via configuration (I don't recall how).

Anyone else dislike the idea? Like, having ignore patterns be ported automatically to everyone that wants to clone the repo just seems.... always better than making people do it themselves. At basically no cost.

I actually like it a lot for stuff that is user specific, not repo specific. I imagine someone could have a "build.log" to view the build output in some specific way that hooks up to a mini taskbar app or some other random shit.

I've personally added some files that don't relate to the project at all and has no reason for being inside a .gitignore and I've had to add it many times.

Global gitignore is for idiosyncrasies of your computer, not for repo-specific stuff. For example if you use an editor that writes in-place backup or swap files (like .swp files with Vim's default settings), or you're on a Mac which writes .DS_Store files into every directory, you're going to want those ignored for every repo. That way you can comfortably work with other people's repos, even if they're not configured for your particular setup.

The global ignore combines with gitignore files in each repo. So if it's an ignore pattern that everyone working with that repo should have, put it in the repo.

I really like the global gitignore. I get annoyed when people check in files that are specific to their particular text editor, so I recommend to new contributors adding anything that is specific to their IDE or text editor to their global gitignore so I don’t have to have a bunch of vim and emacs and vs code and atom and webstorm and who even knows what other stuff in my project gitignore.

I have the same preference for personal projects, but when I was working on a corporate team it was really useful to have the "run configs" for intellij checked in so that each new team member didn't need to set them up by themselves. Some of the setup needed to get the python debugger properly connected to the project could get quite gnarly.

+1 for checking in your config when you can mandate everyone uses the same tool chain. My point is more that the existence of global gitignore supports my open-source use case without precluding your corporate use case.

Gitignore settings don't prevent checking in run configs if that's what you want to do. Even if someone has the run configs pattern ignored, they'll get those files with the repo clone. Gitignore only prevents adding files that aren't already checked in - it's a guard rail to prevent accidentally checking in so something you don't want. You can override ignore settings to check in something new in with git add --force <filename>

shrug To each their own, I guess.

I can definitely appreciate that opinion, I just... disagree. I don't really give 2 shits about a file having some stuff in it that I don't personally use, so long as it still has a purpose. I.E. I'll take a little clutter in a file like that, that basically never gets looked at or edited, over the chance of cluttering up the repo itself, or PRs, or history with stuff that has no purpose at all.

If you're contributing to a larger project, it might not be trivial to modify the .gitignore file, because you might have to go through a review process and so on. It might be easier to just ignore something locally.

It's not set by default i think?

hello day 1 of bluelightmaxxing this is my blog do you like it

Completely off topic, but

Unfortunately, I didn't check that before monkeying with things, so I have no idea if I've changed my system accidentally.

Reading this makes me feel so powerful to be as familiar as I am with podman/docker (which to be clear is a modest amount). Just do:

podman run --rm -it debian:latest bash

Then apt install git, check those folders, and finally exit so the entire container gets automatically deleted.

The whole thing is done in a few seconds (or more depending on how long git takes to download and whether the debian image is already cached)

Everyone on Linux should have this in their toolbelt.

The solution to the problem is to install git into a clean system so you can observe what changes it makes.

How would you do this with Nix?

I guess you misunderstood my question, because that won't work. nix-shell -p git doesn't provide an isolated operating system. They only isolate programs and libraries. If your native git installation modified something in your home folder, those changes will still be visible inside a nix shell.

I'm not sure what you're trying to accomplish in those other commands, as they just seem to print out git's dependencies?

Also, I see you're actively editing your comment as I'm typing so sorry if you actually post the answer after I hit Reply.

Well, you're clearly very passionate about nix, but all you've shown is how to install git in an isolated shell, which again isn't what I was asking.

I don't have anything against nix, but it doesn't seem like the right solution to the particular problem that was presented.

midwest.social

Rules

  1. No porn.
  2. No bigotry, hate speech.
  3. No ads / spamming.
  4. No conspiracies / QAnon / antivaxx sentiment
  5. No zionists
  6. No fascists

Chat Room

Matrix chat room: https://matrix.to/#/#midwestsociallemmy:matrix.org

Communities

Communities from our friends:

Donations

LiberaPay link: https://liberapay.com/seahorse