我从git克隆了存储库A的主分支,并创建了自己的分支Li.我前段时间做了一些改动,把当地李的内容推到了偏远的李.
现在我已经从远程主机到本地主分支以及从本地主分支到本地Li的一些更新,我正在尝试将更新从本地Li推送到远程Li.但是,当我尝试运行时:
git checkout Li
git push origin Li
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
error: failed to push some refs to 'git@github.com:anodejs/system.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
请注意,我的本地主分支已更新(我调用了git pull origin master)并合并到本地Li分支.但是,我确实在本地Li添加了一个新文件,因此本地Li与本地主人不同(但这不应该,对吧?)
谢谢,李
Siv*_*raj 36
更新被拒绝,因为推送的分支提示在其远程后面.
git config --global push.default current
Run Code Online (Sandbox Code Playgroud)
尝试上面的命令将当前分支设置为默认值
git push
Run Code Online (Sandbox Code Playgroud)
Chr*_*her 29
找到差异git fetch && git log Li..origin/Li
.我猜你Li
自从上次推动以来你已经重新定位或以其他方式重新开始,但是这个命令应该告诉你遥控器中究竟是什么不在本地.您可以使用三点语法找到(但不是两者)中的内容:git log Li...origin/Li
.
如果期望差异,那么只需合并git merge origin/Li
然后git push
.如果更改是不需要的,请用git push -f origin Li
.覆盖遥控器.只有在您想放弃远程更改时才执行此操作.
归档时间: |
|
查看次数: |
67165 次 |
最近记录: |