Git discard local changes
up:: Git
Discard a file
git checkout @ -- file@ is an alias for HEAD
For the whole branch
git fetch --all
git branch backup-main # optional
git reset --hard origin/mainDiscard last commit, keep changes
git reset --soft HEAD~1