Git's Magic Files

nesbitt.io

97 points by chmaynard 9 hours ago


masfuerte - 4 hours 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?

Jenk - an hour ago

Since using jj I'm on the lookout for some kind of setting that will exclude the .jj folder from the repo _and_ any operation including git clean, without having to add it to the repo. I.e., make it completely invisible to git including `git clean -xdf`!

At the moment I'm making do with aliasing `git clean -e .jj`

DHowett - 4 hours 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.

jakub_g - 2 hours ago

I'd like to emphasize the `.git/info/exclude`, which is a "repo-local gitignore", i.e. only for you and only for this repo.

Useful when you want to create a temporary file to help you e.g. with a bug investigation, and make sure it stays untouched while you switch branches, and to avoid accidentally committing it.

I have a shell alias like this:

    git-ignore-local () {
      echo "$1" >> .git/info/exclude
    }
and use it like `git-ignore-local myfile.ext`
retrodaredevil - 5 hours 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.

semanticc - 2 hours ago

> GitHub’s contributor graphs use mailmap.

This is not true, .mailmap is [unfortunately] not supported by GitHub: https://github.com/orgs/community/discussions/22518

paulddraper - 6 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.

chmaynard - 3 hours ago

For a deeper dive on git ignore files, see:

https://nesbitt.io/2026/02/12/the-many-flavors-of-ignore-fil...