不能推或拉Git

问题描述 投票:2回答:2

我是使用Git的新手,但我确实理解了基础知识。但是,我还没有遇到过推/拉冲突的情况......直到现在。

另外,我应该指出,我用来与Git存储库交互的GUI工具是Atlassian SourceTree(我们使用Atlassian Stash来管理我们的repo)。

这是场景:

我有2次提交到Push,显然我需要对Pull进行4次更改。

当我尝试Pull我得到这个:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin

git -c diff.mnemonicprefix=false -c core.quotepath=false pull --no-commit origin master
You have not concluded your merge (MERGE_HEAD exists).

Please, commit your changes before you can merge.

Completed with errors, see above.

它说我需要完成我的合并,但它不允许我做任何事情。我没有得到合并列表,也没有自动合并。我似乎无法通过合并,所以我可以继续解决Push/Pull冲突。

当我尝试Push我得到这个:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
Pushing to http://[email protected]:XXXX/XXXX/XXXX/XXXXX.git
To http://[email protected]:XXXX/XXXX/XXXX/XXXXX.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'http://[email protected]:XXXX/XXXX/XXXX/XXXXX.git'
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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

现在我怎么解决这个问题?!我是否需要Rebase或类似的东西?

我正在阅读关于Fast Forward Push但我不知道如何在这个工具中做到这一点。如果必须,我当然可以从终端执行Git命令。我只是不想在没有咨询有更好理解Git和这些类型问题的人的情况下跳进去。

git atlassian-sourcetree bitbucket-server
2个回答
7
投票

看起来你正处于合并的中间(也许是之前的尝试?)

git merge --abort将取消该合并,并使您处于可以重试拉动然后解决冲突的状态。


1
投票

完成合并。 git status会告诉你什么是闲逛。对于每一个,您需要编辑以修复冲突并执行git add。然后git commit。然后拉,然后推。

© www.soinside.com 2019 - 2024. All rights reserved.