gpt4 book ai didi

git: "Updates were rejected because the tip of your current branch is behind.."但如何查看差异?

转载 作者:IT王子 更新时间:2023-10-29 00:43:51 26 4
gpt4 key购买 nike

我刚刚完成了一段代码。想要 push 并得到已经有名的:

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.

现在我已经看到这个问题在这里发布了好几次,例如

Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g

Updates were rejected because the tip of your current branch is behind

根据具体情况,解决方法是

  • git pull,以便将远程更改 merge 到我的本地工作,或者
  • git push -f,强制推送以更新远程(原始)分支。

现在,我已经有一段时间没有在这个分支上工作了。我不一定要将远程更改 merge 到我当前的工作中!我也不知道我是否可以安全地强制对原始分支进行更新...

我怎样才能看到差异并决定哪个最适合我的情况?

最佳答案

为了查看差异,首先您需要从原始存储库中获取提交:

git fetch 来源

现在你可以看到差异(假设你在 master 分支上)git diff HEAD..origin/master

现在您已经掌握了在推送更改之前决定mergerebase 的知识。

关于git: "Updates were rejected because the tip of your current branch is behind.."但如何查看差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45293263/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com