š§ TIL: global .gitignore
(dandean.com)
from CombatWombatEsq@lemmy.world to programming@programming.dev on 11 Feb 01:38
https://lemmy.world/post/42985618
from CombatWombatEsq@lemmy.world to programming@programming.dev on 11 Feb 01:38
https://lemmy.world/post/42985618
#programming
threaded - newest
Yes, I believe this was made for MacOS users. I donāt need to see your
.DS_Storefiles!Yes. If thereās ever a truly epic Mac zero day, I have faith that whoever finds it will use it to add
.DS_Storeto 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
thehackernews.com/ā¦/new-slap-flop-attacks-expose-ā¦
www.ibm.com/ā¦/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.dbFTW!Or for Dolphin users.
Wow that is really blue, checks background color:
Iām surprised it wasnāt
reallybluehello day 1 of bluelightmaxxing this is my blog do you like it
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 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.
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.
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.
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>Itās not set by default i think?
If youāre contributing to a larger project, it might not be trivial to modify the
.gitignorefile, because you might have to go through a review process and so on. It might be easier to just ignore something locally.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
.swpfiles with Vimās default settings), or youāre on a Mac which writes.DS_Storefiles 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.
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).
Completely off topic, but
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:
Then apt install git, check those folders, and finally
exitso 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.
I prefer to flip the logic of the
.gitignore.This includes the files and folders (and their subfiles/folders), while recursively ignoring any pycache bullshit.
I like this solution a lot. I hope I remember it the next time I initialize a repository.