git discard local commits code example
Example 1: git remove all local commits
git reset --hard origin/<branch_name>
Example 2: revert unpublished commits
git reset --hard <hash-or-ref>
git reset --hard origin/<branch_name>
git reset --hard <hash-or-ref>