how to discard local commits in git code example Example: git remove all local commits git reset --hard origin/<branch_name>