!! be very careful with these !! you may end up deleting what you don't want to remove untracked git clean -f -d CAUTION: as above but removes ignored files like config. git clean -f -x -d CAUTION: as above, but cleans untracked and ignored files through the entire repo (without :/, the operation affects only the current directory) git clean -fxd :/ Delete all local branches but keeping others like "develop" and "master": git branch | grep -v "develop" | grep -v "master" | grep -v "main" | xargs git branch -D removes staged and working directory changes git reset --hard Setting your branch to exactly match the remote branch can be done in two steps: git fetch origin git reset --hard origin/master If you want to save your current branch's state before doing this (just in case), you can do: git commit -a -m "Saving my work, just in case" git branch my-saved-work