Search code examples
gitrevertgit-revert

How to git-revert only partially as in git-add -p?


I noticed the introduction of an error in a previous commit that also contains some otherwise correct changes (which, at that time, seemed related enough to put all into a single commit1). Now if I simply git-revert the commit, I also revert the good changes, so is there a way to choose which part to revert, maybe similar to the way git-add -p works?

1) also, I was fresh to git back then...


Solution

  • git revert -n and discard changes you don't need before committing?