Hub: `hub pull-request` should allow a different default branch to be set

Created on 26 Mar 2012  路  14Comments  路  Source: github/hub

Most helpful comment

For future searchers (as this is top of Google), to set the correct branch:

git remote set-head origin <new-branch>

All 14 comments

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"}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

le0nik picture le0nik  路  4Comments

nicksergeant picture nicksergeant  路  3Comments

aryan9600 picture aryan9600  路  3Comments

stsewd picture stsewd  路  4Comments

DennisSchiefer picture DennisSchiefer  路  4Comments