Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在整个新Github存储库上创建拉取请求_Git_Github_Pull Request - Fatal编程技术网

如何在整个新Github存储库上创建拉取请求

如何在整个新Github存储库上创建拉取请求,git,github,pull-request,Git,Github,Pull Request,如何创建整个存储库的请求以供审阅?首先,创建一个名为review的新分支。这只是为了安全起见,这样您就不会意外地清除master和整个存储库 git checkout -b review git push origin review 创建没有历史记录的孤立分支 git checkout --orphan empty git rm -rf . git commit --allow-empty -m "root commit" git push origin empty 有关

如何创建整个存储库的请求以供审阅?

首先,创建一个名为review的新分支。这只是为了安全起见,这样您就不会意外地清除master和整个存储库

git checkout -b review
git push origin review
创建没有历史记录的孤立分支

git checkout --orphan empty
git rm -rf .
git commit --allow-empty -m "root commit"
git push origin empty
有关创建空分支的详细信息,请参见

现在,如果您转到Github并尝试打开一个从master到empty的pull请求,您将得到以下错误消息:

没有什么可比的。empty和review是完全不同的提交历史记录

要解决这个问题,您需要将empty合并到review中,以便它们共享历史

git checkout review
git merge empty --allow-unrelated-histories
git push origin review
现在,您可以在Github中创建一个pull-request-of-review-into-empty