undo all commits code example
Example 1: git delete local commit
git reset --hard origin/<branch_name>
Example 2: revert unpublished commits
git reset --hard <hash-or-ref>
Example 3: undo reset commit git
git reflog //to get commitID
git reset #commitID