Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: how to merge a pull request into a fork?

Tags:

git

github

My situation is as follows: - I have a fork of an opensource github project. - I do all of my development in my forked repo in branches from the develop branch - There is an unmerged pull request I need in the main repo's develop branch - To test the unmerged pull request I created a new directory and cloned origin to it then fetched the unmerged request to the main - Now that I've tested the unmerged pull request, i need to merge the pull request with my fork of develop.

What steps will allow me to merge the pull request into my local fork?

like image 963
catbadger Avatar asked Apr 14 '16 16:04

catbadger


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.

How do I merge a pull request?

To accept the pull request, click the Pull Requests tab to see a summary of pending pull requests. If you are happy with the changes, click Merge Pull request to accept the pull request and perform the merge. You can add in a comment if you want. Once you click Merge Pull request, you will see a button Confirm merge.

What do you do with a fork after pull request?

You can delete your fork as soon as you submit a Pull Request, regardless if it's merged or not. GitHub stores all PRs in the upstream repository, meaning proposed changes are tracked even if the fork is deleted.


1 Answers

~/your-repo $ git remote add pr-source https://github.com/<user-providing-pull-request>/<repo-name>

~/your-repo $ git fetch pr-source

~/your-repo $ git merge pr-source/<pull-request-branch-name>

Note that:

  • you don't need the main repo, either from github or cloned locally
  • you don't need a clone of the repo providing the pull request, you just need it as a remote
  • you don't have to call it pr-source, I was just using that as "pull request source"
like image 102
user2926055 Avatar answered Sep 26 '22 22:09

user2926055