Stage specific lines with git add -p

2019-08-18

For example:

git add -p my-file.js

will start an interactive prompt that will show every hunk (block of changed lines) in the file and ask if you want to stage it or not (among other options).

https://stackoverflow.com/questions/4309156/commit-specific-lines-of-a-file-to-git