Git's Magic Files

(nesbitt.io)

51 points | by chmaynard 5 hours ago

4 comments

  • masfuerte 15 minutes ago
    > GitHub, GitLab, and Gitea all respect .gitignore and won’t show ignored files in the web UI

    Is this right? These tools don't show ignored files because they aren't part of the repository. If a now-ignored file has made it into the repository, surely you want to see it?

  • DHowett 21 minutes ago
    .git-blame-ignore-revs, while great, unfortunately belongs in the “Other Conventions” section.

    If you configure your git client to use it, git blame will fail in any repository in which one is not present.

  • retrodaredevil 1 hour ago
    This is a well put together list. One thing that frustrates me is that not all tooling respects mailmap. IntelliJ has an open feature/bug request for integrating mailmap into its git functionality. Additionally, the .git-blame-ignore-revs is more of a convention because you still have to manually configure that to be the file name to use.
  • paulddraper 2 hours ago
    > Global ignores are good for OS-specific files like .DS_Store or Thumbs.db that shouldn’t clutter every project’s .gitignore.

    News to me and a lot of people.

    I see a lot of .DS_Store in a lot of gitignore.

    • OJFord 1 hour ago
      I have mixed feelings about it really, I am aware of it, and use it in my dot files, but I think it's quite a gotcha - just recently actually I've been thinking to remove it.

      It catches me out when something's ignored I don't expect, and it's not clear why in the working directory/repo, only for me to remember about the global one.

      It catches others out (or catches me out by their doing) in collaboration when say I've not committed something, not even really been aware of the potential hazard, and that's been desired; but then someone else comes along and `git commit -a`s it.

      But then where it is particularly useful is myriad tools that fall back on git ignore in lieu of (or in addition to) their own ignore files...

    • jmholla 2 hours ago
      You still want to put these kinds of things in every project where you are collaborating. You can't depend on everyone to know and do this, so best to just be prepared for those who don't.
      • Defletter 1 hour ago
        I have this two liner as part of my post-os-install setup script:

            curl -fsSL https://www.toptal.com/developers/gitignore/api/linux > ~/.gitignore
            git config --global core.excludesFile ~/.gitignore
        • OJFord 1 hour ago
          Assuming your global config is ~/.config/git/config, you can download it to ~/.config/git/ignore and not need the overriding explicit excludesFile.
      • phyzome 1 hour ago
        I'd prefer to leave them out. That way I can see who's not paying attention when they make commits and are just doing `git commit -a -m "yolo"`.