if you want to revert a commit from your git stack, you can do those following.
- if you want to revert the commit but, not lose the changes you can type
git reset --soft HEAD@{index of the commit
}
- if you want to delete the commit from your git stack
git reset --hard HEAD~index of the commit
Just one thing. if you want to use those commands, you should know that it removes from the first commit until the commit you'll assign. that means if you want to remove git reset --hard HEAD~2
it will remove from commit index 1
until commit index 2
.
Of course, also you can use git revert
but is the same pattern. you'd type the index commit from your head stack
example to revert to two commits prior
git revert HEAD~2