Git — How to undo the most recent local commits in Git
Have you committed the wrong files to Git, but didn’t push the commit yet ?
2 min readSep 14, 2021
Undo a commit & redo
$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~ # (1)
[ edit files as necessary ] # (2)
$ git add …