How would I create a fork and create a PR for a local repository?

We are providing a code drop to our customer via GitHub and unable to fork and create a PR.

Locally, we developed some code, with a long commit history. Now, our customer is asking us to provide the code to him.

As far as I understand, the standard practice is that the customer would create a repo, I’d fork it, populate with our local commits and create PR to the customer, so he could review and accept our work.

This is where the problems start:

  • If the customer creates the repository populated with README.md, I fork it successfully but I’m unable to create a PR because of the different commit history.
  • If the customer creates an empty (without the README.md) repo, GitHub doesn’t allow me to fork this empty repo.

How would I pass the repository to the customer, so he would be able to review, comment and accept our work?

Forking is used when there is an established repository that someone wants to contribute code to. It works like this:

  1. Alice has a repository with a bunch of code in it that she’s been working on for a while
  2. Bob wants to contribute code to Alice’s repository
  3. Bob forks Alice’s repository
  4. Bob adds code to their fork of Alice’s repository
  5. Bob opens a Pull Request to Alice’s repository

Your situation is different because you’re the one with the code and you want to hand over the code to the customer. So you can’t use the normal forking process.

What you can do is either grant your customer collaborator access to your repository or:

  1. Have your customer create a blank repository
  2. Have your customer grant you collaborator access to their repository
  3. Import a copy of your repository into the customer’s blank repository

I hope that helps! Let us know if you have more questions.

1 Like