Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull-request -p pushes to upstream instead of origin #2451

Open
lorthirk opened this issue Jan 23, 2020 · 3 comments
Open

pull-request -p pushes to upstream instead of origin #2451

lorthirk opened this issue Jan 23, 2020 · 3 comments
Labels

Comments

@lorthirk
Copy link

Command attempted:
❯ hub pull-request -p

What happened:
After writing the PR text, the branch got pushed to upstream instead of origin:

❯ git pull-request -p
Enumerating objects: 30, done.
Counting objects: 100% (30/30), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (16/16), 1.12 KiB | 575.00 KiB/s, done.
Total 16 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6), completed with 6 local objects.
remote:
remote: Create a pull request for 'fix-restDatastoreContentType' on GitHub by visiting:
remote:      https://github.com/eclipse/kapua/pull/new/fix-restDatastoreContentType
remote:
To github.com:eclipse/kapua
 * [new branch]          HEAD -> fix-restDatastoreContentType
Branch 'fix-restDatastoreContentType' set up to track remote branch 'fix-restDatastoreContentType' from 'upstream'.
https://github.com/eclipse/kapua/pull/2834

More info:

❯ git remote -v
origin	git@github.com:lorthirk/kapua.git (fetch)
origin	git@github.com:lorthirk/kapua.git (push)
upstream	git@github.com:eclipse/kapua.git (fetch)
upstream	git@github.com:eclipse/kapua.git (push)
hub --version
git version 2.25.0
hub version 2.13.0

on macOS 10.15.2

@lorthirk lorthirk added the bug label Jan 23, 2020
@csaska
Copy link

csaska commented Mar 1, 2020

I've noticed this as well. Based on the documentation, is this really a bug though?

I do wish that hub by default pushed to origin rather than upstream. Perhaps instead we should try and make this a feature. Maybe we could add some sort of hub config option where you could specify the default remote for the -p flag?

From the doc:

 -p, --push
Push the current branch to HEAD before creating the pull request.

@lorthirk
Copy link
Author

lorthirk commented Mar 1, 2020

Uh... Did I misunderstand the convention then?

In case there are multiple git remotes that are all pointing to GitHub, hub assumes that the main one is named "upstream", "github", or "origin", in that order of preference.

When working with forks, it's recommended that the git remote for your own fork is named "origin" and that the git remote for the upstream repository is named "upstream". See https://help.github.com/articles/configuring-a-remote-for-a-fork/

@mislav
Copy link
Owner

mislav commented Mar 1, 2020

@lorthirk There is really no established convention for where the preferred push target should be.

If I have write access to "upstream", I prefer pushing there. Some other people prefer pushing to their fork. Some projects even require that all PRs come from a fork, even those authored by people who have write access to the main repo. Whatever we decide as a default, we end up disappointing some people cli/cli#350

I'm not sure if I want to add an option to select the push target, because you can just as easily push the branch yourself before invoking git pull-request. Does that seem like an appropriate workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants