Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.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 stash pop“;使用Git Bash时发生冲突?_Git_Git Bash - Fatal编程技术网

“我如何合并”;git stash pop“;使用Git Bash时发生冲突?

“我如何合并”;git stash pop“;使用Git Bash时发生冲突?,git,git-bash,Git,Git Bash,我有一个foo.cpp文件。主分支上有一个修改 merge conflict test, make a master modification. 在同一行的分支br1上有另一个修改 merge conflict test, make a local modification and will stash it. 现在,我在br1上保存本地修改,然后重新设置主分支的基础 git rebase origin/master 然后我git stash pop本地修改,这里我得到了冲突 <&l

我有一个
foo.cpp
文件。主分支上有一个修改

merge conflict test, make a master modification.
在同一行的分支br1上有另一个修改

merge conflict test, make a local modification and will stash it.
现在,我在br1上保存本地修改,然后重新设置主分支的基础

git rebase origin/master
然后我
git stash pop
本地修改,这里我得到了冲突

<<<<<<< Updated upstream
merge conflict test, make a master modification.
=======
merge conflict test, make a local modification and will stash it.
>>>>>>> Stashed changes
>隐藏更改
问题出在这里。当我在Visual Studio上工作时,我知道我可以在VS GUI中单击“合并”按钮来编辑冲突。在那之后,我可以
git--继续
来处理这个冲突


但在当前情况下,我没有VS。我不知道如何编辑冲突的命令。我可以在记事本中编辑它,因为冲突很简单,但我不知道如何将其标记为已解决。

在弹出隐藏后,您可以运行
git status
以获取有关可以执行的某些操作的信息。解决冲突后,可以添加文件以将冲突标记为已解决:

$ git checkout master
$ <make changes to file>
$ git add file
$ git commit -m "on master, make some changes to file"
$ git checkout -b b1 HEAD~
$ <make local changes to file>
$ git stash
$ git rebase master
$ git status
  On branch b1
  Unmerged paths:
     (use "git reset HEAD <file>..." to unstage)
     (use "git add <file>..." to mark resolution)

           both modified:   file

  no changes added to commit (use "git add" and/or "git commit -a")
$ <edit file to resolve conflicts>
$ git add file
$ git reset
$git签出主机
$ 
$git添加文件
$git commit-m“在主机上,对文件进行一些更改”
$git结帐-b b1头~
$ 
$git隐藏
$git rebase主机
$git状态
在b1分支上
未合并路径:
(使用“git重置磁头…”取消分级)
(使用“git add…”标记分辨率)
均已修改:文件
未向提交添加任何更改(使用“git add”和/或“git commit-a”)
$ 
$git添加文件
$git重置

git reset
将取消显示对文件所做的所有更改。不必解决冲突,但它会使您恢复到与隐藏和重新设置基础之前类似的状态。

您必须使用
git add
将其添加到索引中。这将冲突标记为已解决,您可以使用
git merge--continue
继续合并。@kowsky,我也查过这个
git-add
可以工作,但是
git-merge--continue
出现错误:未知选项“continue”如果您没有
git-merge--continue
,您的git已经相当旧了(运行
git--version
以获取其版本号)。不过,
git merge--continue
所做的只是验证是否有合并要完成,然后运行
git commit
——这样您就可以运行
git commit
,因为您没有
--continue
选项。