Fetch latest refs
git fetch originSwitch to branch
git checkout <branch>Hard reset to remote
git reset --hard origin/<branch>DestructiveRemove untracked files
git clean -fdDestructive
Notes
- Stash or back up local work before destructive commands.
- Use --dry-run with git clean first when unsure.
Related commands: git fetch --prune, git reset --hard, git clean -fd
Related workflows: Undo last commit, Compare branches