Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default fork for pull requests?

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?

like image 879
riney Avatar asked Jul 22 '15 20:07

riney


People also ask

Can you fork a pull request?

You can create a pull request to propose changes you've made to a fork of an upstream repository. Anyone with write access to a repository can create a pull request from a user-owned fork.

Do I need a fork for a pull request?

If you don't have access to create branches on that repository, there is no way to create a pull request without forking.

How do I sync my original forked repo?

To sync your forked repo with the parent or central repo on GitHub you: Create a pull request on GitHub.com to update your fork of the repository from the original repository, and. Run the git pull command in the terminal to update your local clone.


1 Answers

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.

like image 105
robrich Avatar answered Oct 10 '22 05:10

robrich