Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

What does `git restore -p` and `git checkout -p` offer?

AdvancedConceptUndoing changes: reset, revert, restore and reflog
Answer

They let you discard selected hunks interactively rather than whole files, which is useful to remove debug prints while keeping real changes. git restore -p --staged unstages hunks.

All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog