2

The common circumstance is like this: in the github.com, we could fork another developing repository into our own account and continue the development with our own ideas. But meanwhile, the original repository we forked would also be alive thus have many pull requests. So, how could we git pull these pull requests, which hadn't been accepted into the dev branch by the main contributor of the original repository, into our local repository?

UPDATED

enter image description here

mining
  • 3,557
  • 5
  • 39
  • 66
  • If you want you can backup the current dev branch (i.e. before merging) into another branch i.e. `git checkout -b dev-backup` then `git push origin dev-backup` then accept the push requests but you have a backup of your stable branch to compare against (i.e. quickly compare in local) – DrewT Jul 27 '14 at 23:38
  • Also, not quite sure what you mean by `push request`. On Github normally your repo gets pull-requests then it's your choice if you want to merge in from these users. If you want to test their code locally just pull a branch from them using `git remote add REMOTENAME git@github.com:USERNAME/BRANCHNAME` then `git pull REMOTENAME BRANCHNAME`. You do not have to commit this branch to the origin and you can pull it into any branch, most likely a new branch named the same or similar as their remote name and branch name :D – DrewT Jul 27 '14 at 23:50
  • @DrewT, thank you for replying! The common circumstance is like this: in the `github.com`, we could fork another developing repository into our own account and continue the development with our own ideas. But meanwhile, the original repository we forked would also be alive thus have many `push requests`. So, how could we `git pull` these `push requests`, which hadn't been accepted into the `dev` branch by the main contributor of the original repository, into our local repository? – mining Jul 28 '14 at 00:07
  • What is a `push request`? Are you sure you don't mean `pull-request`? – DrewT Jul 28 '14 at 00:15
  • @DrewT, sorry for my misunderstanding of `pull requests`. But I think the `pull request` should be named `push request` because the contributors request to `push` their contributions into the main repository not `pull`, the `pull` is to update the local repository from the remote repository. – mining Jul 28 '14 at 00:30

2 Answers2

1

Okay, I think I understand the issue - you've received notifications from users that they would like to have their work, which is located in separate forks, merged into the main development repository.

Take a look at this section of the git pull-request docs:

The fork & pull model lets anyone fork an existing repository and push changes to their personal fork without requiring access be granted to the source repository. The changes must then be pulled into the source repository by the project maintainer. This model reduces the amount of friction for new contributors and is popular with open source projects because it allows people to work independently without upfront coordination.

Now, if you want to check out one of these branches locally:

  • git remote add REMOTENAME git@github.com:USERNAME/BRANCHNAME
  • git checkout -b develop-THEIRS
  • git pull REMOTENAME THEIR_BRANCHNAME
DrewT
  • 4,983
  • 2
  • 40
  • 53
0

With a script, you could:

From there, you can get the url of the fork repos (head repo), add them as remote, fetch them, merge the branch of the PR (the head.branch)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250