$ git push -u origin "master" [rejected]

$ git push -u origin "master"
To https://gitee.com/ee/0523.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/ee/0523.git'
hint:

Updates were rejected because a pushed branch tip is behind its remote counterpart.

Check out this branch and integrate the remote changes (e.g. 'git pull ...') before pushing again.
See the 'Note about fast-forwards' in 'git push --help' for details.

============================

 强推: 

git push --force-with-lease origin 本地分支名:远端分支名
git push --force origin master:master

============================

 如果强制推送,则可能会给签出该分支的所有其他用户造成问题。风险较小的解决方案是从分离的头创建一个临时分支,然后将该分支合并到主分支中:

git branch temp-branch
git checkout master
git merge temp-branch
git push origin master

============================
posted @ 2024-05-23 15:05  emanlee  阅读(3)  评论(0编辑  收藏  举报