remove current commits git code example Example 1: git clear commits git reset --hard origin Example 2: revert unpublished commits git reset --hard