How do I reset my local branch to be just like the branch on the remote repository?
I did:
git reset --hard HEAD
But when I run a <
First, use git reset to reset to the previously fetched HEAD of the corresponding upstream branch:
git reset --hard @{u}
The advantage of specifying @{u} or its verbose form @{upstream} is that the name of the remote repo and branch don't have to be explicitly specified. On Windows or with PowerShell, specify "@{u}" (with double quotes).
Next, as needed, use git clean to remove untracked files, optionally also with -x:
git clean -df
Finally, as needed, get the latest changes:
git pull