Hacker News new | past | comments | ask | show | jobs | submit login

Wow this is neat. I never really bothered to deep-dive into my git configuration, but some of these are really cool.

The diff changes are awesome, and I always wondered why there isn't a global .gitignore file in the first place, seeing that every .gitignore file basically has (mostly) the same content




I mentioned it in the post as well, but Git will look in `.config/git/ignore` if you prefer to just use that rather than setting a new path.

There's also a possible downside here in having things hidden for you but not for others since it's not in your `.gitignore` project file.

I'm honestly kind of on the fence about this one, I don't have much in that file for those reasons.


I have .DS_store in mine, as I'm on a Mac and don't need to spread that to others.


Or ".vscode" folder. No need to spread that to everyone, who might not even be using VSCode or VSCodium. Like we also don't see all of the following being added everywhere: ".settings" (eclipse), ".idea" (IntelliJ Idea), ".nbproject" (I believe Netbeans) and others everywhere in the repos. Yet we see it for VSCode. I think Github encourages this annoying behavior, because it is Microsoft's own tool, so it gets treated differently. People see this and copy this bad habit without reflecting on it. What so many others do cannot possibly be wrong...

I find it annoying to have those folders on my machine, that I don't need, but yet are checked into the git tree, so I basically cannot delete them, without affecting another person, when they pull my changes. Why you check that in bro??? Ugh.

I don't check in my Emacs backup files and shit either. I would like to aee their long faces, when faced with all of the files and folders other tools leave behind. People just aren't capable to configure their editors properly I guess and therefore rely on local config for things that could be global config or in a ".editorconfig", like for example trimming trailing whitespace.


It's very common for shared project-specific setting files to be stored in ".vscode" that are used by all developers on the project, including launch/task configurations. VSCode settings are hierarchical and composable (non-scalar keys are merged).


if one would use ".editorconfig" it works with multiple editors/IDEs. See editorconfig.org for more info :)


I am aware of that. Yet I don't see other cohorts doing that with their editor/IDE of choice. It seems to be mostly the "I don't want to configure my tools" subset, who does that. What if I switch my tool of choice 2-3 times? Do I get to commit all my project management IDE/editor specific files too? How much stuff do we want to accumulate in the git repo?


> Do I get to commit all my project management IDE/editor specific files too

Yes, if those files apply to all team members using the same tool absolutely check them in. What's the problem? It reads to me like maybe you don't know what these files are actually used for and why a team benefits from sharing them.


The whole point is, that not everyone is in the bubble of VS Code users, and not everyone wants to have that stuff on their machine, and not everyone is benefiting from it either. Imagine cloning some repo and having extra stuff in there from 3 different IDEs and 3 different editors. This stuff clutters up the repo.


Good point.


There's also an ongoing effort among creators to not pollute the home directory with too many hidden files. Instead, as the blog post mentions, there exist .config/git/ignore which I think is a more scalable approach in the long run. Especially looking at the number of tools and utilities requiring one or several config files.


I prefer difftastic (https://github.com/Wilfred/difftastic) as diff tool.

I think it's the most readable and understandable diff.


At the end of the article, I also subtly plugged:

* https://github.com/so-fancy/diff-so-fancy

* https://github.com/dandavison/delta

Also both great TUI diff tools


One of the coolest things I've learned about recently is `.git/info/exclude`. It allows you to ignore files in the local repo without modifying the repo's .gitignore

Very useful if you want to add your own .envrc or shell.nix to a repo.


I just add .envrc and shell.nix to my global gitignore. Along with docker-compose.override.yml. You can always force-add an ignored file, it'll be tracked from then on.


$XDG_CONFIG_HOME/git/ignore




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: