当前位置:   article > 正文

解决:git push时出现 hint: Updates were rejected because the tip of your current branch is behind

hint: updates were rejected because the tip of your current branch is behind
git push时出现 hint: Updates were rejected because the tip of your current branch is behind
问题:
parkin@wangyan:~/duapp/consignment$ git push
To code.aliyun.com:xxx/xxxxxx.git
 ! [rejected]        wy -> wy (non-fast-forward)
error: failed to push some refs to 'git@code.aliyun.com:xxx/xxxxxx.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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
原因:(我出现这种情况的)

某次提交时多提交了一些文件,后期用git reset --mixed把这些文件删掉了,重新add commit push。导致本地仓库和远程仓库文件不一致。所以我直接强制推送到远程分支了,成功的如下图。
在这里插入图片描述

解决办法:强制推送到远程分支
git push -u origin xxxx -f 
  • 1
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号