force update the current branch – how?
I’m on the
my-backup branch. Now I do
git fetch origin my-backup and
origin/my-backup is updated and I see that it was forced pushed. Now I need to updated my local
my-backup branch to point to
origin/my-backup branch. I do
git branch -f my-backup origin/my-backup but get the warning:
fatal: Cannot force update the current branch. What is the best way to force update current branch to remote without checking out other branch?
One Solution collect form web for “force update the current branch – how?”
git reset --hard origin/my-backup
This will reset your current branch (
my-backup) with losing all your local changes.
git branch -f my-backup origin/my-backup is allowed only if your current branch is not