Git SCM
1 min read
Committing Partial Changes in a Changed File
(credit: https://stackoverflow.com/a/1085191)
$ git add --patch <file>
# you'll be presented with a patch and asked:
# Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]?
The options are:
y: add this change to stagedn: do not stage this changes: automatically split this change into smaller changesq: do not stage this or any remaining changes?: print help
Afterwords:
git diff --staged <file>will show you the staged changes for the filegit reset -pwill undo the staged changes