Git Cherry-pick vs Merge Workflow - Git Cherry-pick vs Merge Workflow

問題:

Assuming I am the maintainer of a repo, and I want to pull in changes from a contributor, there are a few possible workflows: 假設我是回購的維護者,並且我想從貢獻者那裏獲取更改,那麼有一些可能的工作流程:

  1. I cherry-pick each commit from the remote (in order). 我從遠程中cherry-pick每個提交(按順序)。 In this case git records the commit as unrelated to the remote branch. 在這種情況下,git將提交記錄爲與遠程分支無關。
  2. I merge the branch, pulling in all changes, and adding a new "conflict" commit (if needed). merge分支,拉入所有更改,並添加新的“衝突”提交(如果需要)。
  3. I merge each commit from the remote branch individually (again in order), allowing conflicts to be recorded for each commit, instead of grouped all together as one. merge遠程分支中的每個提交單獨merge (再次按順序),允許爲每個提交記錄衝突,而不是將所有提交組合爲一個。
  4. For completeness, you could do a rebase (same as cherry-pick option?), however my understanding is that this can cause confusion for the contributor. 爲了完整性,你可以做一個rebase (與cherry-pick選項相同?),但是我的理解是這會導致貢獻者的混淆。 Maybe that eliminates option 1. 也許這消除了選項1。

In both cases 2 and 3, git records the branch history of the commits, unlike 1. 在情況2和3中,git記錄了提交的分支歷史記錄,與1不同。

What are the pro's and con's between using either cherry-pick or merge methods described? 使用所描述的cherry-pickmerge方法之間有什麼優點和缺點? My understanding is that method 2 is the norm, but I feel that resolving a large commit with a single "conflict" merge, is not the cleanest solution. 我的理解是方法2是常態,但我覺得用單個“衝突”合併解決大型提交併不是最乾淨的解決方案。


解決方案:

參考一: https://stackoom.com/question/5D1k
參考二: Git Cherry-pick vs Merge Workflow
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章