# Created on savesnippets.com · https://savesnippets.com/O55qIY1pCHW7Az # Soft check: how far ahead/behind are we? git fetch origin git status -sb # ## main...origin/main [ahead 3, behind 2] # Discard local commits, reset to origin/main exactly git fetch origin git reset --hard origin/main # Also wipe untracked files (DANGEROUS — review first) git clean -fdx -n # -n = dry run, shows what WOULD be removed git clean -fdx # actually do it # Nuclear option: reset + clean to a pristine state matching origin git fetch origin git reset --hard origin/main git clean -fdx