1. 21

  2. 13

    It’s not enough for me to write a good personal/global gitignore file if other contributors don’t. A few extra lines in this whitelist/blacklist aren’t hurting anyone.

    …although it does give me an idea: create the biggest .gitignore file by scraping every .gitignore off github and sorting it to be unique.

    1. 2

      create the biggest .gitignore file by scraping every .gitignore off github and sorting it to be unique.

      Of course, you’d need a big-enough corpus of valid files to exclude stuff like * or maybe *.c.

    2. 9

      Very true, but in a world where you’re happy if half your team doesn’t commit as “user@users-macbookpro.local” this is kinda at the bottom of my list of pet peeves :P

      1. 4

        I don’t think making a commit just to add stuff to .gitignore is worthwhile. But I would rather people explicitly add items to a project’s .gitignore (along with substantive changes) so everyone is aware of what’s being ignored.

        I’ve never been bugged by crap in a .gitignore that has .vscode even though I don’t use VSCode.

        I like explicit when it’s not expensive or distracting. I think it helps reduce confusion and if I don’t frequently work with a project it helps me drop in and send a pull request or perhaps write up an issue more easily.

        1. 3

          One junior dev on my team once suggested to use a whitelisting gitignore, which only specified the file to keep (for example, everything in src/, config/, a few dotfile file at the root..). I was skeptic at first, but I gotta admit that it solved rather elegantly this issue, as any combination of editor was automatically ignored.

          The downside was that whitelisting in a gitignore has a bit of a wonky syntax, and it made it easier to forget to add a file that was not already whitelisted. But all in all, I think this is something that should be tried more.

          1. 2

            I would certainly lean more towards .git/info/exclude which is a private gitignore just for that repo. That was I can leave things that are specific to my machine in there and they don’t dirty up my global gitignore