Search code examples
githubgit-branchgit-pushgit-pullgit-fork

github forked repository: How to pull the changes from forkedrepo/branch to orignalrepo/<Create-new-branch>


UserA Original Repository Creator: No branches. Master only.
UserB Forks the repository and makes some changes and creates a new branch and puts the changes into github.com/userB/repo-name/newbranch-name

How can userA ,

  1. pull the changes from github.com/userB/repo-name/newbranch-name and
  2. put into a new branch with the same name as of userB ....that is, github.com/userA/repo-name/newbranch-name

Some info on current scenario
UserB(forked user) is not available to push those changes - the question is not "how can I get to do something" but "how can I do something myself" without requesting userB to push the changes to UserA (Original repo creator)
In addition, UserA doesnt want to merge this to MASTER.
UserA prefers to put these changes in a new branch. i.e. github.com/UserA/repo-name/{create-new-branch}


Solution

  • Add userB's repository as a remote, pull it to a new branch locally, then push it to userA's repository:

    git remote add userA github.com/userA/repo-name
    git remote add userB github.com/userB/repo-name
    git pull userB newbranch-name
    git push userA newbranch-name