git远程分支强制覆盖本地分支

Git 2023-07-26 417次浏览

刚看见有人反馈测试问题,随手切分支改了下,忘记提前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.

git远程分支强制覆盖本地分支

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址