gpt4 book ai didi

git - 不能在我自己的分支上推送,非快进?

转载 作者:太空狗 更新时间:2023-10-29 14:47:27 24 4
gpt4 key购买 nike

所以我不确定这是否是我的问题的原因,但我不小心做到了:

git push -u origin master

代替:

git push -u origin facebook

当我在我的 facebook 分支上时。它回应:

Branch master set up to track remote branch master from origin.

现在当我尝试推送时:

To git@git.url.com:url.git
! [rejected] facebook -> facebook (non-fast-forward)
error: failed to push some refs to 'git@git.url.com:url.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.

我也 pull 不动:

You asked me to pull without telling me which branch you
want to merge with, and 'branch.facebook.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:

[branch "facebook"]
remote = <nickname>
merge = <remote-ref>

[remote "<nickname>"]
url = <url>
fetch = <refspec>

See git-config(1) for details.

最佳答案

好吧,这是当您尝试推送时,您在文件中所做的更改与 Git 中的最新版本冲突。

试试这个:

git pull origin facebook

如果有错误:

git merge
git commit -a -m 'message'
git push origin facebook

关于git - 不能在我自己的分支上推送,非快进?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18927526/

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