简体   繁体   English

如何在具有完全不同的提交历史的分支之间创建拉取请求

[英]How can I create a pull request between branches with entirely different commit histories

I have two branches with entirely different commit histories, and I need to create a pull request - NOT MERGE - from one of them to the other.我有两个具有完全不同的提交历史的分支,我需要创建一个拉取请求- 不是 MERGE -从其中一个到另一个。 When I tried it gave me this:当我尝试时,它给了我这个: 完全不同的提交历史的 github 错误消息

I tried to push a mutual commit, but this is not working.我试图推动相互提交,但这不起作用。 What is the best practice for it?它的最佳实践是什么? I'm a beginner and this is my first time dealing with it.我是初学者,这是我第一次处理它。

What should I do to create this pull request with all files contained in the pull branch?我应该如何使用pull分支中包含的所有文件创建此 pull request?

It is possible to make a pull-request equivalent of git merge --allow-unrelated-histories .可以发出等同于git merge --allow-unrelated-histories的拉取请求。 You can do it like so:你可以这样做:

# First, create a new branch based on main:
git switch -c history-merge main

# Next, merge your branch with the unrelated history into `history-merge`
#
# Resolve any merge conflicts at this time,
# and change the merge text to "Merge branch 'unrelated' into main".
git merge unrelated --allow-unrelated-histories

# Push your new branch:
git push -u origin history-merge

Once that's done, you can create a pull request from history-merge into main .完成后,您可以创建一个从history-mergemain的拉取请求。

If you want it to be 100% seamless, choose the rebase option when you go to merge the PR.如果你希望它是 100% 无缝的,请在 go 合并 PR 时选择rebase选项。 This will fast-forward main to the original merge-commit.这会将main快进到原始的合并提交。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 两个分支拉取请求产生完全不同的提交历史 - Two branches pull request yeilds entirely different commit histories 需要创建一个拉取请求但完全不同的提交历史和 --allow-unrelated-history 导致很多冲突 - Need to create a pull request but entirely different commit histories and --allow-unrelated-histories causing lots of conflicts GIT 使用具有不同历史记录的分支创建拉取请求 - GIT create pull request with branches with different histories 如何推送到主,主和主是完全不同的提交历史? - How to push to main,main and master are entirely different commit histories? 没有什么可以比较的。 没什么可比较的,分支是完全不同的提交历史 - There isn't anything to compare. Nothing to compare, branches are entirely different commit histories main 和 master 是完全不同的提交历史。 我正在向我的 github 添加一个新的存储库 - main and master are entirely different commit histories. I am adding a new repository to my github 当git历史不同但更改相同时,如何发送pull请求? - How to send pull request when git histories are different but changes are same? 如何在非主分支之间创建拉取请求 - how to create pull request between non master branches 如何针对派生仓库中两个分支之间的差异的上游基础创建拉取请求? - How do I create a pull request against an upstream base that is the difference between two branches in my forked repo? 分支之间的不同提交 - Different Commit between branches
相关标签
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM