Reputation: 2331
I have an upstream project which I have forked. I created a new branch on my local and made changes to it. Now I wish to push to a branch upstream so my friend can see it. Can I push code that I changed in my own fork to a branch in the upstream by passing pull requests? Do I need to create a branch in my upstream first? How do I accomplish this?
I have tried:
git push upstream my-upstream-branch
which resulted in:
error: src refspec my-upstream-branch does not match any
error: failed to push some refs to 'https://github.com/upstream-repo'
I have all of my code checked in.
I also tried to create a new branch from the upstream branch and got
git checkout -b shell-ui upstream/shell-ui
fatal: 'upstream/shell-ui' is not a commit and a branch 'shell-ui' cannot be created from it
Upvotes: 1
Views: 1221
Reputation: 521
If you want to open a PR in the upstream you'll only need to:
*You'll see something like the shown here.
Upvotes: 0
Reputation: 151
You need push the branch with change to your forked repo or to upstream repo first.
To push your branch to your forked repo
git push --set-upstream origin branch_name
To push to upstream repo
git push --set-upstream upstream branch_name
And then you can create a pull request.
If you have pushed to the branch to your forked repo, then you need to create a pull request from new branch of the forked repo to the main branch of the upstream repo
If you have pushed to the branch to upstream repo, then you need to create a pull request from the new branch in upstream to the main branch of upstream
Upvotes: 1