Courses / GitHub
31. Interactive staging with git add -p
Selecting hunks interactively to stage partial changes using git add -p or git add -i.
1 min read Chapter 31 of 32
Git / Bash
Interactive staging with git add -p
A way to pick and stage only parts ("hunks") of changed files before committing.
"I fixed two unrelated bugs in one file but only want to commit them separately."
git add -p walks you through each change hunk and asks whether to stage it, so you can make precise commits from mixed edits.
"I fixed two unrelated bugs in one file but only want to commit them separately."
git add -p walks you through each change hunk and asks whether to stage it, so you can make precise commits from mixed edits.