Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何解决git中的分歧?_Git_Merge_Version Control_Git Branch - Fatal编程技术网

如何解决git中的分歧?

如何解决git中的分歧?,git,merge,version-control,git-branch,Git,Merge,Version Control,Git Branch,我很难解决工作副本上的问题: 早些时候,我拉了几个文件,它们自动合并,然后出现在我没有提交的暂存区。我通过git checkout恢复了文件中的更改--my/file现在,在当天晚些时候,我想再做一次拉取,但做不到,我得到了如下错误: $ git pull error: You have not concluded your merge (MERGE_HEAD exists). hint: Please, commit your changes before merging. fatal: Ex

我很难解决工作副本上的问题: 早些时候,我拉了几个文件,它们自动合并,然后出现在我没有提交的暂存区。我通过git checkout恢复了文件中的更改--my/file现在,在当天晚些时候,我想再做一次拉取,但做不到,我得到了如下错误:

$ git pull
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
我怎样才能解决这个问题?我不想在这个分支上做任何事情!我还得到:

$ git status
On branch dev
Your branch and 'origin/dev' have diverged,
and have 3 and 4 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
$git状态
关于分支开发
您的分支和“起源/发展”已发生分歧,
和分别有3个和4个不同的提交。
(使用“git pull”将远程分支合并到您的分支中)
所有冲突已修复,但您仍在合并。
(使用“git提交”结束合并)
未跟踪的文件:
(使用“git add…”包含在将提交的内容中)
首先,git合并--quit()应该有助于摆脱正在进行的合并

其次,
git pull--rebase
应该有助于在更新的
origin/dev
上重放本地提交

然后你可以推

通过以下方式使其工作()


git pull
意味着运行两个git命令:首先,运行
git fetch
,然后运行第二个git命令。第二个命令默认为
git merge
。如果您先前运行了
git pull
,它可能已经运行了
git merge
(取决于您是否更改了
git pull的第二个命令)。这可能是你仍然处于冲突的合并中的原因。在完成另一个代码> git拉< /COD>之前,您必须要么完成这个合并,要么中止它。(您最好通过一个好的Git教程来服务。Git是一个众所周知的初学者敌对者,而您现在正处于其中的一个中间。)正确的命令是“代码> Git合并-ABORT < /代码>,
git pull--rebase
根据需要解决了问题!太好了,谢谢@太棒了。我已将您的评论包含在答案中,以提高可视性。
git push --abort
git pull --rebase