我有兩個具有完全不同的提交歷史的分支,我需要創建一個從其中一個到另一個的拉取請求- NOT MERGE 。當我嘗試時,它給了我這個:
我試圖推動相互提交,但這不起作用。它的最佳做法是什么?我是初學者,這是我第一次處理它。
我應該怎么做才能使用pull分支中包含的所有檔案創建這個拉取請求?
uj5u.com熱心網友回復:
可以使拉請求等效于git merge --allow-unrelated-histories. 你可以這樣做:
# First, create a new branch based on master:
git switch -c history-merge master
# Next, merge your branch with the unrelated history into `history-merge`
#
# You named this branch `pull`, but I've renamed it to
# `unrelated` for the sake of example.
#
# Resolve any merge conflicts at this time,
# and change the merge text to "Merge branch 'unrelated' into master".
git merge unrelated --allow-unrelated-histories
# Push your new branch:
git push -u origin history-merge
history-merge完成后,您可以從into中創建拉取請求master。如果您希望它是 100% 無縫的,rebase請在合并 PR 時選擇該選項。這將快進master到原始的合并提交。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/470880.html
