hunk
One block of nearby changed lines in a diff, shown with a few unchanged lines around it for context.
In more detail
Each hunk starts with a header such as @@ -1,3 +1,4 @@ giving the line numbers in the old and new versions. git add --patch lets you stage hunk by hunk.
Related terms
- diff — A listing of the differences between two versions of something, such as two files, two commits or two screenshots.
- 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.
Taught in
- Staging Deliberately: status, add, add --patch — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows