我已经环顾了一段时间,并且试图找到答案的不同选项,但我正在努力完成此功能。我们有很大的变化,有时某些变化不会被循环批准,而我们的小组希望转向一种敏捷的方法。
我们在git的存储库中有此当前设置:
Master - C1
Release1 - C1
Develop - C1 - C2 - C3 - C4 - C5 - C6
我们在某个时间点与第一个版本一起开发了从Master创建的,所有这些都处于同一提交级别。然后开发进行连续的提交流,有些通过测试,有些则没有。我们如何将特定的提交从开发转移到Release1?
类似的东西:
Master - C1 - - - - - Master
/
Release1 - C1 - C3 - C5 - C2
Develop - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9
例如,我尝试了C3上的樱桃挑选,但它带来了C2。任何帮助将不胜感激。
编辑:从这里的评论中是步骤和输出。我正在尝试选择一两个提交,并始终获得相同的结果。我做错了吗?
~/git/cherrypick_test (Develop)
$ git log
commit 9d296fb748731c9252b55bcb52a14d2638112bd1 (HEAD -> Develop, origin/Develop)
Change3 123
commit 3e01cdf9d11043fd58e4684742a3f69ee350b037
Change 125
commit 62ab4c96a767113d22fb2f78d20b6d72587fff86
Change 124
commit c28ce2ea753611f5f5b559f4f6598b2584f3e2f6
Change2 123
commit 7763c4ef9c01b7b7c5189d9b9fa2cedaeff62d68
Change 123
commit 2a60e37761ed3de745e760d5a472fd593c4c9b26 (origin/release/Sprint1, release/Sprint1)
$ git checkout release/Sprint1
Switched to a new branch 'release/Sprint1'
Branch 'release/Sprint1' set up to track remote branch 'release/Sprint1' from 'origin'.
~/git/cherrypick_test (release/Sprint1)
$ git log
commit 2a60e37761ed3de745e760d5a472fd593c4c9b26 (HEAD -> release/Sprint1, origin/release/Sprint1)
~/git/cherrypick_test (release/Sprint1)
$ git cherry-pick 3e01cdf9d11043fd58e4684742a3f69ee350b037 62ab4c96a767113d22fb2f78d20b6d72587fff86
error: could not apply 3e01cdf9d...
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
我不明白为什么会发生冲突,因为这只是将代码添加到一个文件中以进行演示,但是在从Sourcetree打开文件后,我在Merge冲突中看到以下内容:
<<<<<<< HEAD
=======
//adding change 123
//second change 123
//change 124
//change 125
>>>>>>> 3e01cdf9d... SG7-125 test cherry picking function
在此示例中,我只能得到124和125,但两个123都与它们同时。
做这个
git checkout Release1
git cherry-pick C1 C3 C5 C2
然后进行简单的合并。