如何设置拉请求的默认分叉? [英] How to set default fork for pull requests?

查看:90
本文介绍了如何设置拉请求的默认分叉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一套基于我们公司的API的文档,基于TripIt的优秀 Slate框架。根据指示,我分叉他们的回购,并进行定制。这个分支在这里这里



令人讨厌的是,当贡献者在我的组织中做了一个新的拉取请求,Github上的基本分支比较变更屏幕默认为TripIt的存储库,而不是我的分支。他们不止一次地将请求发送到错误的地方。告诉人们不要这样做并不是一个特别可靠的解决方案。如何设置默认的PR到何处为基础?

解决方案

GitHub跟踪通过界面创建的叉假设拉取请求将用于该原始存储库。你需要告诉GitHub你的副本不是一个分支,而是一个正好具有相同历史记录的常规库。不幸的是,GitHub并没有提供一个很好的方法来取消选中fork链接。我通常是这样解决的:


  1. 克隆存储库, git pull ,并确保您的本地副本完全保持最新。


  2. 删除GitHub上的存储库。

  3. li>

    使用完全相同的名称在GitHub上创建存储库。确保它是一个空的存储库(不要创建 README LICENSE 文件。)


  4. git push 将所有内容重新放回存储库。 (您可能需要切换到每个分支并推送它,而且您可能还需要 git push --tags 。)


FRAGILE :此方法将会丢失现有的GitHub问题并提出请求评论。如果您大量使用这些内容,则此方法可能不太合适,您应该与GitHub客户支持联系以提供帮助你代替。


I have a set of documentation for my company's API, based on the excellent Slate framework from TripIt. Per instructions, I forked their repo and proceeded to customize it. That fork lives here.

The obnoxious thing is that when contributors in my organization do a new pull request, the "base fork" on the Github "Comparing Changes" screen defaults to TripIt's repository, not my fork. They've more than once sent pull requests to the wrong place. Telling people "don't do that" isn't a particularly reliable solution. How can I set the default for where PRs are based to my fork?

解决方案

GitHub keeps track of forks made through their interface and assumes pull requests will be for that original repository. You need to tell GitHub that your copy is not a fork but rather a regular repository that just happens to have identical history. Sadly, GitHub doesn't offer a good way to just uncheck the fork link. I typically solve it this way:

  1. Clone the repository, git pull, and ensure your local copy is completely up to date.

  2. Delete the repository on GitHub.

  3. Create the repository on GitHub using the exact same name. Ensure it's an empty repository (don't create a README or LICENSE file.)

  4. git push all the content back into the repository. (You may need to switch to each branch and push it, and you also may need to git push --tags.)

FRAGILE: This approach will lose existing GitHub issues and pull request comments. If you're using these heavily, this approach is probably a bad idea, and you should contact GitHub customer support to help you instead.

这篇关于如何设置拉请求的默认分叉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆