← Back
git

Set local branch to be exactly like remote

I hope I can remember now:

git fetch origin
git reset --hard origin/<name-of-the-branch>

Untracked files needs to be treated separately:

git clean -f

Source: https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head