Git

Creating a PR Without Forking a Private Repository

A note on creating a branch and pull request in a private company repository when personal forks are not allowed.

June 28, 2018

Context

Some companies do not allow developers to fork private repositories into personal namespaces. In that case, a pull request can still be created from a branch inside the same repository if permissions allow it.

Flow

  • Clone the target repository locally.
  • Create a work branch.
  • Change the code and commit it.
  • Push the branch to the remote repository.
  • Use the repository UI to open a pull request back to the original branch.

Key Point

Forking is not the essential part of a pull request workflow. The essential part is having permission to push a branch that can be compared against the target branch.