Interview practice question
Committing only part of your changes
Cloud & DevOps · Git and Version Control · Intermediate
You changed several things in one file but want to commit only the bug fix, not the debugging code. How do you do it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- git add -p for interactive hunks.
- Stage only fix hunks.
- Review with git diff --staged.
- Commit; keep rest unstaged.
- IDE support for partial staging.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.