我决定今天尝试搞乱Git,并尝试了解它的分支系统是如何工作的.馊主意.我不知何故已经处于一个我已经在分支上进行更改的状态,当我执行"git push"时,我得到:
To git@github.com:LAW/Repo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:LAW/Repo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
我已经看过几次,我已经做了"git pull"来解决,虽然我不确定为什么或如何解决问题.问题是,它现在不起作用.我做"git pull"并得到:
"Already up-to-date."
Run Code Online (Sandbox Code Playgroud)
问题依然存在.所以我的问题是......现在怎么样?我不能从分支机构推出,所以它基本上已经死了,但互联网没有比"git pull"更好的建议来解决这个问题.不用说这非常令人沮丧!
编辑评论者要求输出"git branch -a".有问题的分支是"PersonalSite"
* PersonalSite
master
remotes/origin/HEAD -> origin/master
remotes/origin/PersonalSite
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
被拒绝的推送是主 - >主.但你所在的分支机构是PersonalSite.听起来你的主分支有一个远程没有的本地提交,但缺少来自远程的提交.但是,您正在尝试git pull使用PersonalSite.我不确定它试图从哪个分支中取出origin/master(这取决于您在创建分支时可能设置的上游信息).git push并没有试图推送PersonalSite,因为默认情况下,它只会推送"匹配"分支(例如,两侧已经存在的分支),而且PersonalSite仅存在于本地.
你想在这里实现什么?如果要将PersonalSite推送到远程,请使用git push origin PersonalSite.如果你想修复你的主分支,检查它然后运行你git pull(或任何你想做的其他修复).
| 归档时间: |
|
| 查看次数: |
5184 次 |
| 最近记录: |