Right now it's hardcoded to default to "master".
https://github.com/defunkt/hub/blob/master/lib/hub/commands.rb#L118
https://github.com/defunkt/hub/blob/master/lib/hub/context.rb#L149
Yes, the default branch is usually master.
If you want to open a pull request against a different branch, use the -b
option:
git pull-request -b [<owner>/]<branch>
Yeah, I discovered this. I was just thinking it would be nice to set a config default somewhere since Github itself allows you to set a default branch.
Maybe. Not sure if it's worth it. I have come across one or two repos that have their main branch other than "master" (in fact, they might not have a "master" at all), but my experience alone hardly justifies adding and maintaining another hub option.
I'll think about this.
FWIW, we would appreciate this feature as well.
It would be really great if hub could determine github's default branch itself.
A section in .git/config will be good enough. And everybody who use git flow
is with develop
branch as default target for PR's.
Just got bit by this by accidentally merging a pull request to master
instead of our default branch develop
, so this feature would be appreciated. (We're following a model similar to git flow)
Sure, I'm for this. The default branch for a project would be read from GitHub API, right?
I'm not familiar with git flow and the local conventions it has, but I would avoid detect its setup locally and simply read it from GH API. This has a side-effect of adding 1 additional HTTP request to pull-request
command and slowing it down a little.
Yeah, I think reading the default branch set on GitHub should be enough.
Since I don't have time to implement this right now, you're welcome to take a stab at doing it. Test are a must in the end but even a proof of concept would be good for starters.
I might take a stab at this implementation this weekend. I want this very much too.
Closing in favor of #326
For future searchers (as this is top of Google), to set the correct branch:
git remote set-head origin <new-branch>
Or you can run git remote set-head origin -a
to have it automatically determine what's the correct base branch.
This doesn't seem to work when I create the pull-request from a worktree; however, if I switch back to the original clone, the command works perfectly.
From the worktree, I see the following:
{"base":"master","head":"pHWChip:feature/colt_testing","maintainer_can_modify":true,"title":"Testing"}
From the original clone, I see the following:
{"base":"core_master","head":"pHWChip:feature/colt-testing-2","maintainer_can_modify":true,"title":"Testing"}
Most helpful comment
For future searchers (as this is top of Google), to set the correct branch: