Katrina
Katrina

Reputation: 409

Pull requests across separate GitHub repositories that weren't forked from one another?

Is it possible to make pull requests between two different Github repositories? For example, if I have a branch called new-feature in Repository A, can I create a pull request and merge the changes into the master branch in Repository B?

Merging across repos is possible in git, but I can't find anything suggesting that Github supports it.

Upvotes: 12

Views: 8257

Answers (2)

leomilrib
leomilrib

Reputation: 409

If the repos are in different organizations on GitHub you can fork one and create pull requests cross forks from the GitHub interface.

But if you want to create pull requests between repos from the same organization on GitHub, you can edit the remotes on the original repo (Repository A in your example) and then "send" branches cross GitHub repositories and create the pull requests using GitHub interface.

Check my answer on git fork repo to same organization for more details.

Also, please note that this is only possible if Repository A and Repository B share at least part of commit history, otherwise you will just get a message like:

repositoryA/new-feature and repositoryB/master are entirely different commit histories.

When you try to create the PR.

Upvotes: 4

SloppyJoe
SloppyJoe

Reputation: 403

The following would merge the changes of ProjectA with the ProjectB

# go to  projectB:
git remote add projectA path/to/projectA/NewFeature
git fetch projectA
git merge projectA/master 

Now Push these changes to your github ProjectB repository.

git push origin master

Upvotes: 7

Related Questions