我将开发分支代码合并到 master 时遇到了一些冲突,并决定创建一个Integration分支。我做了 cherry-pick 从开发分支到Integration分支的所有必需提交。
现在,当我将更改提交到Integration分支时,它将所有合并(使用cherry-pick)视为新提交。我很好。但在合并之后,当我比较开发和集成分支时,文件已更改的差异相同。
是否有人有过类似的问题。感谢
以下是我在场景中所做的步骤,我在本地开发分支中创建了一个文件,然后切换到集成分支并使用cherry-picked来合并开发分支中的提交。本地分支机构git diff integration ...开发没有显示任何差异,这是很好的...但是在github上,当我比较开发和集成分支时,文件更改仍然显示。如果有很多提交我挑选了,我发现很难看出哪些提交被选中。
git status
# On branch master
nothing to commit, working directory clean
git checkout -b development
Switched to a new branch 'development'
git diff master..development
vim test_cherry_pick.txt
git status
# On branch development
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test_cherry_pick.txt
nothing added to commit but untracked files present (use "git add" to track)
git add test_cherry_pick.txt
git commit
[development 0b88adc] Added temp file to test cherry_pick
1 file changed, 1 insertion(+)
create mode 100644 test_cherry_pick.txt
git diff master..development
diff --git a/test_cherry_pick.txt b/test_cherry_pick.txt
new file mode 100644
index 0000000..d7b8e14
--- /dev/null
+++ b/test_cherry_pick.txt
@@ -0,0 +1 @@
+This file is to test cherry_pick
git checkout master
Switched to branch 'master'
git checkout -b integration
Switched to a new branch 'integration'
git diff master..integration
git cherry-pick 0b88ad
[integration 297e93b] Added temp file to test cherry_pick
1 file changed, 1 insertion(+)
create mode 100644 test_cherry_pick.txt
git diff development..integration
注意:我使用GitHub GUI工具将集成和开发分支发布到origin。
答案 0 :(得分:0)
当挑选git不明白提交实际上是相同的。似乎Github Compare会执行一个git请求 - 拉动,它显示樱桃挑选的提交与&#34;相同&#34;使用新ID提交。