Go to your fork repository. Click on New pull request . Make sure to set your fork as the base repository, and the original (upstream) repository as a head repository. Usually, you only want to sync the master branch.
Make sure you've pulled the new upstream branch into your local repo:
git fetch upstream
to retrieve the new upstream branchCreate and switch to a local version of the new upstream branch (newbranch
):
git checkout -b newbranch upstream/newbranch
When you're ready to push the new branch to origin:
git push -u origin newbranch
The -u switch sets up tracking to the specified remote (in this example, origin
)
I would use
git checkout -b <new_branch> upstream/<new_branch>
I had trouble with this too, and google took me here. The solutions didn't work however. My problem was that when i added my upstream, it set up my git config to only fetch master, rather than all branches. e.g. It looked like this
[remote "somebody"]
url = [email protected]:somebodys/repo.git
fetch = +refs/heads/master:refs/remotes/upstream/master
Editing .git/config as follows fixed my problem
[remote "somebody"]
url = [email protected]:somebodys/repo.git
fetch = +refs/heads/*:refs/remotes/upstream/*
The following steps worked well for me (assuming the upstream branch name is branch
):
$ git fetch upstream
$ git checkout branch
$ git push origin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With