You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have the newly created branch issue-99 checked out and do gh pr create, I am first asked where to push the branch to and then the PR gets created.
But If I use gh pr create --head issue-99 or gh pr create --head Vampire:issue-99, the CLI requires that the branch is already pushed.
When having the branch checked out it of course makes not much sense to use --head.
But if you for example use Jujutsu VCS around Git, then you usually do not have a branch checked out.
So there it would be nice if using --head would also push the new branch like when not using --head.
Affected version
gh version 2.82.0 (2025-10-15)
Steps to reproduce the behavior
gh pr create --head some-newly-created-branch
Expected vs actual behavior
Expected: Branch is pushed
Actual: pull request create failed: GraphQL: Head sha can't be blank, Base sha can't be blank, No commits between master and some-newly-created-branch, Head ref must be a branch (createPullRequest)
Reacted by Eugene Vilensky, Kirill Korolyov and Will Slattum
I believe skipping push when --head is provided is intended. Here is a snippet from the help doc:
When the current branch isn't fully pushed to a git remote, a prompt will ask where
to push the branch and offer an option to fork the base repository. Use --head to
explicitly skip any forking or pushing behavior.
I don't know much about Jujutsu, but maybe a new flag like --push to always push the branch might also be a solution here?
Ah, ok.
I can of course also push with jj first and then just create the already pushed PR using gh, that's what I did now, just that I then also have to type out --head Vampire:already-pushed-branch and cannot do --head already-pushed-branch.
But yeah, a --push option might also be handy.
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the
help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
@BagToad actually that it did not push was just half of the problem.
I now pushed some new branches via JJ first and tried then to do gh pr create -H fix-version-comparison or gh pr create -H fix-version-comparison -B main, but both still failed with
pull request create failed: GraphQL: Head sha can't be blank, Base sha can't be blank, No commits between main and fix-version-comparison, Head ref must be a branch (createPullRequest)
So my problem is not only the missing --push option, but also that it does not work to PR from a different branch.
Only after switching to the intended branch and doing gh pr create I got it working.
@Vampire Apologies for the delay! That error message is unfortunate because it seems that's a general error message from the API for various reasons. I know you can get that same error message currently when trying to make a cross org PR sometimes as well 🤔
The short is that I'm not entirely sure the exact cause in your case. I'd love to review the GH_DEBUG=api gh pr create ... output if you bump into this again.
Activity
BagToad commentedon Oct 20, 2025
Hey @Vampire, thanks for the issue! ✨
I believe skipping push when
--headis provided is intended. Here is a snippet from the help doc:I don't know much about Jujutsu, but maybe a new flag like
--pushto always push the branch might also be a solution here?Vampire commentedon Oct 20, 2025
Ah, ok.
I can of course also push with
jjfirst and then just create the already pushed PR usinggh, that's what I did now, just that I then also have to type out--head Vampire:already-pushed-branchand cannot do--head already-pushed-branch.But yeah, a
--pushoption might also be handy.github-actions commentedon Oct 20, 2025
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
xnh22q9nw9-jpg commentedon Oct 25, 2025
Vampire commentedon Oct 28, 2025
@BagToad actually that it did not push was just half of the problem.
I now pushed some new branches via JJ first and tried then to do
gh pr create -H fix-version-comparisonorgh pr create -H fix-version-comparison -B main, but both still failed withSo my problem is not only the missing
--pushoption, but also that it does not work to PR from a different branch.Only after switching to the intended branch and doing
gh pr createI got it working.BagToad commentedon Nov 12, 2025
@Vampire Apologies for the delay! That error message is unfortunate because it seems that's a general error message from the API for various reasons. I know you can get that same error message currently when trying to make a cross org PR sometimes as well 🤔
The short is that I'm not entirely sure the exact cause in your case. I'd love to review the
GH_DEBUG=api gh pr create ...output if you bump into this again.