About git revert and reset


I need a quick Git assist – I’m stuck trying to undo the “Finish story” commit (212bd14) without losing history. I tried git revert --soft but got an error (apparently that flag doesn’t work with revert?).

git reset --soft will undo some or all commits form. those you have not yet pushed, and return those changes to the staging area (so you can edit and re-commit). It takes a range relative to the HEAD (most recent commit) of you local repo.
So git reset --soft HEAD~1 does the most recent, git reset --soft HEAD~2 the two most recent etc. If you use --hard then it simply forgets those commits and the changes are deleted.

git revert needs a commit ID and generates a new commit that reverses the changes in the given commit ID. You can use this to revert (effectively undo) a commit that’s already been pushed to the remote, without trashing the commit history. The original commit still exists, and the revert commit undoes its changes further up the history.