To simply execute a "I want this branch to point to this commit":
git checkout pr/10 # Checkout the branch
git reset --hard 1a234b5 # Move it 1a234b5.
You might also be able to say:
git checkout pr/10
git reset --hard origin/pr/10
Note that command will reset your working directory and index (due to --hard
, feel free to leave that off), so if you have changes, git stash
them first.
The git branch -D
, git checkout
thing works because git
, not able to find a branch named pr/10
, but seeing that one is in your remote with that name, will create a new branch at the point where your remote branch is, thus recreating it in the right spot.