无法推入或拉入 Git

Can't Push or Pull in Git

我对使用 Git 还很陌生,但我确实了解基本知识。但是,我还没有遇到 Push/Pull 冲突的情况……直到现在。

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

场景如下:

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

当我尝试 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://XXXXXX@XXXXXXXX.XXXX.XXXX:XXXX/XXXX/XXXX/XXXXX.git
To http://XXXXXX@XXXXXXXX.XXXX.XXXX:XXXX/XXXX/XXXX/XXXXX.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'http://XXXXXX@XXXXXXXX.XXXX.XXXX: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 status 会告诉您正在闲逛的内容。对于每一个,您都需要编辑以解决冲突并执行 git add。然后git commit。然后拉,然后推。

您似乎正在进行合并(也许是之前的尝试?)

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