How can I throw away local git commits when getting “Your branch and ‘origin/master’ have diverged”? June 25, 2023 by Tarik git fetch origin git reset --hard origin/master Note that any non-pushed commits or local changes will be lost.