刚看见有人反馈测试问题,随手切分支改了下,忘记提前git pull了,修改后报错,正好说下如何使用远程分支覆盖本地的分支修改
git pull --force <远程主机名> <远程分支名>:<本地分支名>
报错信息如下:
robin@APB21115053 ~/htdocs/ngxcode/vendor positive_realtime git push
To ssh://git.intra.ngxcode.com:2222/fe/ngxcode.git
! [rejected] positive_realtime -> positive_realtime (non-fast-forward)
error: failed to push some refs to 'git.intra.ngxcode.com:2222/fe/ngxcode.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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.