How to set default fork for pull requests?

后端 未结 3 2094
花落未央
花落未央 2020-12-15 04:46

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.

相关标签:
3条回答
  • 2020-12-15 05:09

    Your other developers seem to have forked TripIt's repository, so that is the source/parent of their work. In fact, if you open your own repository, you will see it hasn't been forked at all (the fork count is 0).

    When they issue a merge request, by default github shows that repository as source, and so the pull request isn't sent to you.

    The simplest workaround in this case is to ask your dev's to fork your repository, and work on it.

    0 讨论(0)
  • 2020-12-15 05:18

    It is unfortunate that GitHub does not provide a way to configure the default PR target repo.

    If you can delete (or get the owner to delete) the original repo A from which B was forked, then that will do the trick.

    If it is not possible/agreeable to delete A, but the owner of A is willing to do the following, then the fork link gets broken, on GitHub Enterprise at least:

    • mark repo A as Private
    • mark repo A as Public again

    After doing this, repo B (which was originally forked from A) will default to opening PRs against itself, rather than A.

    Note: if A itself was forked from something further back in the history, then unfortunately it seems that B starts defaulting to opening PRs against that repo once A has gone. The only solution would be to apply the above to all repos upstream in the fork tree :(

    0 讨论(0)
  • 2020-12-15 05:31

    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.

    0 讨论(0)
提交回复
热议问题