Contextual .gitignores
A while ago, I had the strong desire to partition some of my professional work logs into mutually exclusive git repositories: with Blacklists and Whitelists flipped.
I was aware that the .gitignore
could ignore stuff; today I found out that I can also whitelist stuff via that.
checkout 1 this stackoverflow question
So if the first .gitignore
looks like
asdf-pattern
more-asdf
some-absolute-asdf
dir-asdf/
the second one would look like:
# blacklist everything first
*
# unignore the directories to capture nested existences
!*/
# then your usual unignores
!asdf-pattern
!more-asdf
!some-absoluete-asdf
!dir-asdf/
What I wonder now is if git would allow for a branch-contextual .gitignore (named with certain protocols) so that I don’t have to maintain two different repositories altogether.