How do I interactively unstage a particular hunk in git?

git gui has a decent GUI to interactively stage or unstage hunks or lines. There are prettier/better GUI clients, but git gui is lightweight, built-in, and cross platform (lin, win, mac).

https://git-scm.com/docs/git-gui

Simply right click on a hunk to stage/unstage. For lines, highlight the lines first, then right click.


Try git reset --patch filename; this should do the opposite of git add --patch, according to the documentation. The short form -p also works for both commands.

Tags:

Git

Staging