I am trying to figure out how to make a PR to my remote repository from a local branch (or even from local master/main branch). However, no matter what I do I get the following error:
Attempt from local main
:
(master)$ gh pr create --title "Adding readme" --body "Testing pr from cli" --head armsp:feature
Creating pull request for armsp:feature into master in armsp/----
pull request create failed: GraphQL error: Head sha can't be blank, Base sha can't be blank, No commits between master and feature, Head ref must be a branch
Attempt from the local feature
branch:
(feature)$ gh pr create --title "Adding readme" --body "Testing pr from cli" --head armsp:feature
Creating pull request for armsp:feature into master in armsp/----
pull request create failed: GraphQL error: Head sha can't be blank, Base sha can't be blank, No commits between master and feature, Head ref must be a branch
The general steps for the whole situation is -
feature
, edit something, commit--head
arguement of gh
from local branch to make PR directly to remote without making the same remote branch--head
arguement of gh
from the local master without making a remote branchI have seen a couple of issues on the github cli repo and they seem to have been fixed in a release, but it unfortunately still doesn't work for me.
My gh
version
$ gh version
gh version 1.2.1 (2020-11-11)
NOTE: It is IMPERATIVE that I make the PR completely via terminal/cli.
To create a pull request, you need to have made your code changes on a separate branch or forked repository. From the open repository, select the Create button and select Pull request in the This repository section of the dropdown menu.
Under your repository name, click Pull requests. In the list of pull requests, click the pull request you'd like to modify. To choose where you'd like to open the pull request, select the Open with drop-down and click one of the tabs.
After the mandatory introduction on what is a Pull Request in Git vs GitHub, I'll quote the following:
Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch. source.
GitHub PR expect some code on the remote GitHub server, at least a branch.
Create a pull request to propose and collaborate on changes to a repository. These changes are proposed in a branch, which ensures that the default branch only contains finished and approved work. source.
You expect to open a Pull Request on remote for a branch that doesn't exists. Create the branch first, then try again. Remember that you won't be able to have the remote automatically fetching or pulling content from your local to the remote, so in the end you'll have to push it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With