git add --patch

A way of staging only some of the changes in a file, by answering yes or no to each hunk Git shows you.

In more detail

Git shows one hunk at a time and asks what to do: y stages it, n leaves it, s splits it into smaller hunks and q quits. It lets one messy afternoon of edits become several commits that each say one thing.

Example

git add --patch recipes.md

Related terms

Taught in

References