remove all local commits code example Example 1: git remove all local commits git reset --hard origin/ Example 2: revert unpublished commits git reset --hard