Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.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:如何通过仅解决tip节点上的合并冲突来合并两个分支?_Git_Merge_Branch_Git Merge_Rebase - Fatal编程技术网

Git:如何通过仅解决tip节点上的合并冲突来合并两个分支?

Git:如何通过仅解决tip节点上的合并冲突来合并两个分支?,git,merge,branch,git-merge,rebase,Git,Merge,Branch,Git Merge,Rebase,这是我的树,有两个树枝:狗和猫 A - B - C - D <- dog | E - F - G - H - I - J - K - L <- cat 我现在需要解决合并冲突,但它似乎要求我从合并A&L、B&L、C&L和D&L中解决合并冲突。我只想解决合并D&L的冲突,因为A、B和C中的所有内容都已反映在D中。有什么方法可以做到这一点吗?A rebase基本上会撤消所有更改(E-L),将您的代码更新为D,然后在D之上进行所有更改(E-L)。这并不是您真正想要的 我认为你应该做一个g

这是我的树,有两个树枝:狗和猫

A - B - C - D <- dog
|
E - F - G - H - I - J - K - L <- cat

我现在需要解决合并冲突,但它似乎要求我从合并A&L、B&L、C&L和D&L中解决合并冲突。我只想解决合并D&L的冲突,因为A、B和C中的所有内容都已反映在D中。有什么方法可以做到这一点吗?

A rebase基本上会撤消所有更改(E-L),将您的代码更新为D,然后在D之上进行所有更改(E-L)。这并不是您真正想要的

我认为你应该做一个git合并

git checkout cat
git merge dog
从git合并手册页:

合并来自命名提交的更改(自其历史记录偏离当前提交时起) 这个命令被git pull用来合并来自另一个分支的更改 并且可以手动将更改从一个分支合并到另一个分支

   Assume the following history exists and the current branch is "master":

                 A---B---C topic
                /
           D---E---F---G master

   Then "git merge topic" will replay the changes made on the topic branch since it diverged from master
   (i.e., E) until its current commit (C) on top of master, and record the result in a new commit along
   with the names of the two parent commits and a log message from the user describing the changes.

                 A---B---C topic
                /         \
           D---E---F---G---H master

如果要合并,为什么要重新设置基础?
   Assume the following history exists and the current branch is "master":

                 A---B---C topic
                /
           D---E---F---G master

   Then "git merge topic" will replay the changes made on the topic branch since it diverged from master
   (i.e., E) until its current commit (C) on top of master, and record the result in a new commit along
   with the names of the two parent commits and a log message from the user describing the changes.

                 A---B---C topic
                /         \
           D---E---F---G---H master