How to undo a mistake on GitHub

GitHub shows a couple of practical ways to undo an accidental commit, depending on whether you already pushed the change or not.

Overview

The video explains two common “undo” paths for commits, based on where you are in your workflow.

If you already pushed the commit

If you have not pushed yet

bash git reset –soft HEAD~1