Reset other branch to current without a checkout

Set otherbranch to point at the same commit as currentbranch by running

git branch -f otherbranch currentbranch

The -f (force) option tells git branch yes, I really mean to overwrite any existing otherbranch reference with the new one.

From the documentation:

-f
–force

Reset to if exists already. Without -f git branch refuses to change an existing branch.

Leave a Comment