discard all local commits git code example Example: revert unpublished commits git reset --hard <hash-or-ref>