I\'m looking for exactly the same behavior as
git add -i -p
But instead of composing a commit from my working directory, I\'d like to compose
You could use git reset --mixed HEAD^1
to revert the index, then pick the hunks you want with git add -i
.
The reset
will roll back the index to the previous commit (essentially un-committing whatever was the HEAD), but it won't touch the working tree. You can now stage the hunks you want, commit them and throw away the rest with a git reset --hard HEAD
.