Skip to main content

Section 6.1 Git Cheat Sheet

202604120002 | git bash terminal

Local Git Reset (Bash).

Multiline version (safer, less likely to accidentally erase local changes):
git fetch origin
git checkout main        # or whatever branch you're using
git reset --hard origin/main
git clean -fd            # removes untracked files & folders
One-liner (⚠️ use with caution!):
git fetch origin && git reset --hard origin/main && git clean -fd