Small team. A colleague pushed to origin:master
by mistake. He has reset his local repo but cannot push -f
to Github because repo is protected.
I have fetch
ed the repo but not merged his errant commit into my local master
...yet.
How can I, assuming I can push -f
to origin, reset origin
on Github so that it reflects the state it was in before his mistake?
$ git push origin 2860a4c:master
To github.com:example/myproj.git
! [rejected] 2860a4c -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:example/myproj.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
Do I really need to integrate the bad commit (with git pull
) before I can then, I assume, reset hard 2860a4c
and then push -f origin
?
I just don't want to make things worse.