Let's say you had commits:
C
B
A
git revert B
, will create a commit that undoes changes in B
.
git revert A
, will create a commit that undoes changes in A
, but will not touch changes in B
Note that if changes in B
are dependent on changes in A
, the revert of A
is not possible.
git reset --soft A
, will change the commit history and repository; staging and working directory will still be at state of C
.
git reset --mixed A
, will change the commit history, repository, and staging; working directory will still be at state of C
.
git reset --hard A
, will change the commit history, repository, staging and working directory; you will go back to the state of A
completely.