CombatWombatEsq@lemmy.world to Programming@programming.dev · 2 days ago🧐 TIL: global .gitignoredandean.comexternal-linkmessage-square28linkfedilinkarrow-up160arrow-down13
arrow-up157arrow-down1external-link🧐 TIL: global .gitignoredandean.comCombatWombatEsq@lemmy.world to Programming@programming.dev · 2 days agomessage-square28linkfedilink
minus-squareNostraDavid@programming.devlinkfedilinkarrow-up12arrow-down1·2 days agoI 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
minus-squareMantisWaffle@lemmy.worldlinkfedilinkEnglisharrow-up1·4 hours agoWhy do you have __pycache__? Is it not already ignored by the catch-all rule at the beginning?
minus-squareCombatWombatEsq@lemmy.worldOPlinkfedilinkarrow-up3·2 days agoI like this solution a lot. I hope I remember it the next time I initialize a repository.
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.
Why do you have
__pycache__? Is it not already ignored by the catch-all rule at the beginning?I like this solution a lot. I hope I remember it the next time I initialize a repository.