frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Staging patches with Git add -p

https://www.simonholywell.com/post/git-add-p/
19•ankitg12•4d ago

Comments

Topgamer7•4d ago
I find grepdiff and this function are pretty useful if you want to pull certain hunks out of a large change set:

    #!/bin/bash
    
    # Put this into your .bashrc, or whatever.
    function git-add-regex {
      git diff -U0 | grepdiff -E "$1" --output-matching=hunk | git apply --cached --unidiff-zero
    }
https://gist.github.com/smuuf/76bde33d65b3dbbc2411e8519f3e6c...
deepsun•52m ago
IntelliJ has that since 2018, with visual change-by-change checkboxes that should go into each commit, very handy.
zikohh•51m ago
I find splitting hunks a pain. I wish I could just split by line, would be a great feature.
petepete•43m ago
I've used tig for longer than I can remember for my selective staging needs.
LVB•42m ago
Use 'e' in -p mode and you can edit the hunks as you wish, choose lines, etc.
embedding-shape•33m ago
The whole "Stage this hunk [y,n,q,a,d,k,K,j,J,g,/,e,p,P,?]?" line is pretty intimidating, but I urge anyone who still wants to understand git and be able to (themselves) use it effectively, to do "?" when you see it, read through what each action does and forcefully try them out to see what they do, in some low stakes project. Ends up being a super quick way of staging a whole bunch of work and avoiding staging other, but it's pretty weird at first glance.
arccy•23m ago
use jj, the default is to select by line
KwanEsq•9m ago
Mercurial's `hg commit -i` with the curses interface is so much better for this it's not even funny. Fortunately I'd assume Jujutsu's UX is similar, based on arccy's comment.
prideout•44m ago
Super useful, and easy to do in the VS Code merge pane.
natbennett•43m ago
In the case of a newly committed file you can add just the file with

git add . -N

And then review the text itself as part of the git add -p workflow

cerved•42m ago
Vin fugitives difftool is even better

Also, you can use -p for stash push

chriswarbo•21m ago
Magit allows selective staging/unstaging, either of hunks, or by selecting lines (AKA Emacs's "region"). I avoid staging from the git commandline, unless I'm just doing whole files.

PS: Majutsu provides this too (a magit-like tool for jj)

goosejuice•9m ago
I always use git add -i which is just one level up. The tui is pretty intuitive for day to day tasks, including staging partial chunks or lines of code.
BeetleB•9m ago
> If you’re not already using git add -p to stage your commits then you’re missing out.

After switching to jujutsu, I assure you I don't miss this feature.

jj takes the opposite approach. It keeps staging things, and you use split whenever you want to separate things out.

(And yes, it stores the staged changes as revisions, so you can always back out to a previous staged state).

pmarreck•5m ago
I've sadly had to back out of using jj after leaning into LLM coding assistance, as (even with an extremely well-written jj guide in its context), it never failed to screw things up more than if I was just using git (I call this an "LLMpedance mismatch" problem)

If LLM coding assistance increases, it's going to be a rather large speed bump to cross

One of the biggest problems is actually unsolvable if you want to keep colocated Git and git tooling around, because it has to do with how jj fundamentally works- detached HEADs, detached HEADs everywhere

The coolest use for the Vision Pro

https://christianselig.com/2026/07/vision-pro-house/
223•robbiet480•2h ago•97 comments

AI's top startups are barely publishing their research

https://www.science.org/content/article/ai-s-top-startups-are-barely-publishing-their-research
73•YeGoblynQueenne•1h ago•53 comments

Show HN: Open-source engine running Gemma 4 26B in 2 GB RAM on any M-series Mac

https://github.com/drumih/turbo-fieldfare
585•gitpusher42•7h ago•206 comments

Superlogical

https://www.superlogical.com/
449•yan•7h ago•285 comments

Kimi K3-256k

https://www.kimi.com/code/docs/en/kimi-code/models
284•monneyboi•3h ago•86 comments

Keychron announces first open-source firmware for gaming mice

https://www.digitalfoundry.net/news/2026/07/keychron-announces-first-open-source-firmware-for-gam...
237•JLO64•6h ago•92 comments

Anatomy of a Frontier Lab Agent Intrusion: A Timeline of the July 2026 Incident

https://huggingface.co/blog/agent-intrusion-technical-timeline
239•artninja1988•1d ago•128 comments

KOReader

https://koreader.rocks/
637•Cider9986•11h ago•205 comments

The Cold Email

https://zachholman.com/posts/cold-email
12•holman•1h ago•2 comments

SalesPatriot (YC W25) Is Hiring FDEs

https://www.ycombinator.com/companies/salespatriot/jobs/M46X6YX-forward-deployed-engineer
1•maciejSz•1h ago

A Trampoline

https://dogdogfish.com/blog/2026/07/29/a-trampoline/
41•matthewsharpe3•2h ago•20 comments

Turning a dumb AC unit smart (without losing my security deposit)

https://prilik.com/blog/post/automating-ac-nyc/
78•austinallegro•4h ago•69 comments

Staging patches with Git add -p

https://www.simonholywell.com/post/git-add-p/
19•ankitg12•4d ago•17 comments

A.I. companies are recruiting electricians and carpenters by the thousands

https://www.nytimes.com/2026/07/29/business/economy/data-center-electricians-training.html
191•thm•8h ago•234 comments

Handbook.md shows that long policy documents do not reliably govern agents

https://arxiv.org/abs/2607.25398
276•spIrr•9h ago•177 comments

Commodification of Intelligence: Good, Bad, and Ugly Circular AI Deals

https://www.emergingtrajectories.com/lh/commodification-and-circularity/
45•cl42•3h ago•24 comments

Claude: Elevated errors across all models

https://status.claude.com/incidents/q2kg8n613kr3
241•gregsadetsky•2h ago•215 comments

Document-borne AI worms can self-propagate through Copilot for Word

https://enklypesalt.com/posts/context-collapse-part3-ai-worming-through-word/
319•Canopy9560•11h ago•243 comments

Launch HN: Tokenless (YC S26) – Automatic model switching to save money

https://usetokenless.com/
46•rohaga•6h ago•41 comments

Refactoring cuisine: how an Iraqi stew sailed to Singapore

https://iza.ac/posts/2026/07/the-journey-of-bamya/
6•infinitewalk•3d ago•0 comments

Show HN: CheapFoodMap – A map of good meals under $10

https://cheapfoodmap.com/
93•jaep1•5h ago•108 comments

How to not die by a thousand cuts or how to think about software quality (2023)

https://www.evalapply.org/posts/how-to-not-die-by-a-thousand-cuts/index.html
43•adityaathalye•4h ago•22 comments

Some thoughts about Anthropic's new cryptanalysis results

https://blog.cryptographyengineering.com/2026/07/29/some-notes-about-anthropics-new-results/
89•supermatou•6h ago•49 comments

Darktable

https://www.darktable.org/
271•siatko•10h ago•132 comments

How much can you delegate to agents?

https://newsletter.posthog.com/p/agent-autonomy
36•duck•3h ago•0 comments

The Rust on ESP Book

https://docs.espressif.com/projects/rust/book/
110•AlexeyBrin•4d ago•9 comments

Hamburg's Stadtpark: A Park Built to Be Used

https://alsterrunde.com/hamburgs-stadtpark-a-park-built-to-be-used/
103•mertbio•2d ago•25 comments

Self-hosting Kimi K3: 20% more hardware cost, 20% better task resolution

https://aistack.imec-int.com/blog/gpu-self-hosting
115•flifenstein•8h ago•40 comments

Hunter-gatherers introduced fish to a mountain lake 7000 years ago

https://www.newscientist.com/article/2580119-hunter-gatherers-introduced-fish-to-a-mountain-lake-...
131•stevenwoo•2d ago•99 comments

Theo Conjecture solves 35-year-old math problem, finds a term no one predicted

https://firstprinciples.com/blog-article/ai-system-theo-conjecture-solves-35-year-old-math-conjec...
27•otalp•2h ago•7 comments