Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Claude Code reads AGENTS.md only when telemetry is on(szypowi.cz)
    131comments
  2. I Don't Want the Details(michaelheap.com)
    68comments
  3. Stripe built its internal AI platform(stripe.dev)
    10comments
  4. Jev in 25 Lines of Python(nobodywho.ai)
    132comments
  5. Z80 REPL(abagames.github.io)
    10comments
  6. GPT-6 Sol and Luna(openai.com)
    793comments
  7. Claude Opus 5.5(anthropic.com)
    1014comments
  8. Jev in practice: typed decisions, scoped authority(tenuo.ai)
    3comments
  9. Tokens Too Cheap to Meter(jyn.dev)
    38comments
  10. Two Git ignore files nobody told me about(dinculescu.dev)
    31comments
  11. Web-based IBM 1620 emulator and IPL-V from 1963(github.com/pkimpel)
    2comments
  12. QuestDB (YC S20) Is Hiring a Sales Engineer(questdb.com)
    discuss
  13. The GitHub wiki is an anti-pattern(michaelheap.com)
    48comments
  14. Samsung accidentally freezes its smart fridges with a software update(androidauthority.com)
    114comments
  15. The Price of Intelligence Is Falling Rapidly(marginalrevolution.com)
    26comments
  16. Montreal adopts bylaw banning insults against police, municipal employees(cbc.ca)
    7comments
  17. Transit rewards(waymo.com)
    249comments
  18. OpenAI GPT–6 Astra breaks Enigma message that has resisted solution since 2005(cryptocellar.org)
    411comments
  19. Microsoft killed FoxPro in 2007. Anyway, here's FoxPro revived(foxscript.org)
    223comments
  20. Show HN: Ive Sent It – online courier for files, with signed proof of delivery(ivesentit.com)
    12comments
  21. What California is learning from solar panels built over irrigation canals(kqed.org)
    531comments
  22. How did AMD Ryzen get 50% faster in two years?(lemire.me)
    167comments
  23. ReBarUEFI: Resizable BAR for almost any UEFI system(github.com/xcuri0)
    61comments
  24. 'We hacked the FBI:' Hackers say they have data on all FBI employees(404media.co)
    519comments
  25. SAML: A fractal of bad design(trailofbits.com)
    153comments
  26. Data-only attacks are easier than you think (2024)(usenix.org)
    31comments
  27. WordPress: Unauthenticated path traversal leading to conditional RCE(github.com/wordpress)
    112comments
  28. Pentagon says overreliance on AI contributed to missile strike on Iran school(bloomberg.com)
    396comments
  29. Claude Opus 5.5 Intelligence, Performance and Price Analysis (Max)(artificialanalysis.ai)
    99comments
  30. Show HN: RxFilm Studio–Create and edit your product videos with AI agent(rxlab.app)
    7comments

Two Git ignore files nobody told me about

48 pointsby 3h agomihai.dinculescu.dev
31 comments
3h agoHN ↗

Thanks I had no idea about these either!

1h agoHN ↗

I'd never heard of .git/info/exclude, core.excludesFile, or ~/.config/git/ignore before. Thanks for posting this!

1h agoHN ↗

This is great, and nicely written up in the context of agentic repos etc, but presumably no-one reads the official docs, right: https://git-scm.com/docs/gitignore where the multiple ways of ignoring files are clearly stated?

1h agoHN ↗

There is a tweet doing numbers on Twitter right now which is effectively:

"Do the reading b/c you would be amazed how many people don't do the reading"

1h agoHN ↗

So many people treat git commands like magic words, and then are terrified when they mess up their repo (example in this xkcd... https://xkcd.com/1597/)

Reading documentation is a superpower

1h agoHN ↗

I'd wager a small sum that git is the tool most of us learned by accident, some of them fortunate, some less so. Thankfully, this one was the former.

1h agoHN ↗

I have never seen these two files in any git repository I've cloned so far.

59m agoHN ↗

That’s because, unlike .gitignore, they are not committed.

1h agoHN ↗

Until Claude suggested .git/info/exclude, it never crossed my mind to question how ignoring worked. A search would have answered it in seconds, but you have to think to ask first. I didn't, and I suspect most people don't either. Especially with git, which nearly everyone learns by doing; very few of us ever sit down and learn it properly. That's why I wrote it up: so a few more people can learn this the way we learn everything else in git, by accident.

Now that you mention it, I should add a link to those docs in the article. Thanks!

47m agoHN ↗

This is true, using AI to help discover better ways of working with stuff is pretty epic, reading docs are about as exciting as writing docs, esp when you are trying to get something done.

1h agoHN ↗

This is great... one thing I wish is to be able to exclude are lines, for instance some lines in my config that only benefits the work I do. Some configs don't allow extending and that's where this would come in handy. Anyone have any tricks for that?

57m agoHN ↗

You can from the checked in config file include a local file which is not checked in (only if it exists).

For example, with direnv, the `.envrc` in my projects usually has

    source_env_if_exists .envrc.local

And the repo also ships with a `.envrc.local.example` file.

27m agoHN ↗

That's a great shout. With more than one ignore file in play, this command is gold.

41m agoHN ↗

Magit really is the only git frontend worth using. It exposes all of this kind of stuff in an easy to use way. You can easily ignore files using all three methods with magit.

The more useful thing here is the "typical use" of each one. People who don't know about other methods get this wrong a lot and put cruft from their own tools/editors in .gitignore which is annoying.

38m agoHN ↗

Just a nit-pick, but some/repo/path/.gitignore isn't necessarily committed to the repo. For example, if your repo has no .gitignore file, you can totally add one in your clone without adding it to the tree. Of course then you can't do something like `git add .` without committing it.

Also `~/.gitignore` works as a global gitignore. I usually stick something like `katie*` in there so I can copy some `script.sh` to `katie_script.sh` and then I can make changes that I don't want to commit.

Quick edit: I'm not sure `~/.gitignore` works out of the box.. looks like I stuck that in my `~/.gitconfig` for excludesfile

2m agoHN ↗

True! But a gotcha there is that if your repo does have a .gitignore in the tree then this trick won't work. I had a coworker try to do just that and we were all pretty confused when his changes kept getting committed. `git add ./` will stage changes to any file in the commit tree, even if that file matches a line in gitignore.

29m agoHN ↗

Out of the box you can use ~/.config/git/ignore and ~/.config/git/config

15m agoHN ↗

I have no ~/.config/git directory, ~/.config/git/config might take higher precedence, but ~/.gitconfig works too.

2m agoHN ↗

Yes you may have to create the directory :)

8m agoHN ↗

I've been using $REPO/.scratch/ and .scratch/.gitignore with just `*` in it as a place for coding agents to use as temp storage (scripts, exports, plans, etc) that won't get committed. It's much easier to access these files under the repo path instead of wading through /tmp.

33m agoHN ↗

I've never seen a .gitignore that was justified, ever. It probably shouldn't even exist. I've run into projects often enough with horked build scripts or bad docs about build pre-requisites, where upon failing partway through and necessitating some fix, the build failure leaves the tree in a state where it still won't build successfully even after fixing the thing that caused the original failure. The only fast fix is to rm .gitignore, then look at the output of git-status and rm -rf all the crap that it shows the original build attempt splattered everywhere before re-running the build script for a third attempt. Thanks, .gitignore.

.gitignore is banished in every project I'm in charge of. Everyone is required to manage their personal .git/info/exclude themselves, and any changeset attempting to slip .gitignore into the project will get ipso facto rejected. (Anyone is free to submit a change that adds a file contrib/gitignore if you think you have a set of useful globs relevant to the project that will be a help to others, along with instructions to cp that file to .git/info/exclude, but .gitignore is not making it in.)

Git needs to ship a git-ignore command (or extend git-config) that exclusively works by managing .git/info/exclude for you, including converting "legacy" .gitignore into the less anti-social version.

16m agoHN ↗

Or, you could have a build system that does a 100% out-of-tree build into ./build, and then if the build is broken you delete that one directory. You hardly need git to help you with that.

10m agoHN ↗

Oh, I can? Cool advice! How do I get the people with bad hygiene that we're talking about to follow it?

(You have lost the plot; your response amounts to explaining how soap and water works to someone who has just described their office mate's tendency not to shower.)

7m agoHN ↗

So all your fellow devs do `ln -s contrib/gitignore ./git/info/exclude`?

Also you can do `git status --ignored` and it will list all files changed, even if ignored. If that is really your main issue.

5m agoHN ↗

This is one of the strangest opinions I've seen in awhile. Your complaint seems like it should be pointed at projects not having a working "clean" make target.

Also:

  git status --ignored
  git clean -ndX # preview what would be removed
  git clean -fdX # actually delete the files (warning: destructive)
27m agoHN ↗

this was probably discovered by many when seeking how to globally ignore agent configs, until perhaps they decided they'd like to start committing agent configs. though that's just a `git add -f`

23m agoHN ↗

On Windows I never found ~/.config/git/ignore. I just used .gitignore for everything.

I've been leaving notes sitting untracked rather than put a filename only I use into the repo. .git/info/exclude is what I actually needed.