logoalt Hacker News

Git's Magic Files

92 pointsby chmaynardtoday at 2:21 PM25 commentsview on HN

Comments

masfuertetoday at 7:13 PM

> 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?

show 3 replies
Jenktoday at 9:39 PM

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`

jakub_gtoday at 9:00 PM

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`
show 1 reply
DHowetttoday at 7:06 PM

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

show 2 replies
retrodaredeviltoday at 6:15 PM

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.

semanticctoday at 8:31 PM

> GitHub’s contributor graphs use mailmap.

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

paulddrapertoday at 5:20 PM

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

show 3 replies
chmaynardtoday at 8:27 PM

For a deeper dive on git ignore files, see:

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