or better known as “staging patches”.

So you created some new functionality in a file but you have a lot of other code you’re not quite ready to commit yet. Answer: git add -p . It will interactively go though modified sections of your file asking if you want to “stage this hunk”. Answer y for yes, n for no, q for stop, then commit as usual. You can even split hunks if you want to get more fine-grained.

For more details check out this page.