How to create pull requests using GitHub CLI without browser?

I’ve been working on a project and need to submit pull requests to the main repository. Right now it looks like I have to go through the GitHub website every time I want to create a PR. This feels pretty slow when I’m already working in the terminal.

Is there actually a way to create and submit pull requests directly from the command line? I’m hoping there’s some kind of tool or method that lets me skip opening the browser and going through the web interface. It would be much faster for my workflow if I could handle everything from my terminal.

Has anyone found a good solution for this? What tools or commands should I be looking into?

Using the GitHub CLI is a streamlined way to create pull requests without relying on the browser. After installing and authenticating the gh tool, you can easily initiate a pull request by running gh pr create directly in your terminal. This command allows you to specify the title, description, and target branch for your PR. The CLI is intuitive, automatically identifying your current branch and suggesting the appropriate base branch. Setting up authentication requires just a one-time action, either through a personal access token or device flow. With this approach, you can efficiently manage PRs while keeping your workflow within the terminal.

GitHub CLI’s authentication is pretty smooth once you set it up. Run gh auth login once and it stores your credentials - no more dealing with tokens every time you create a PR. I love using gh pr create --draft when I’m still working but want early feedback. There’s also gh pr create --web for complex PRs that need the full interface, but I barely use that anymore. The CLI grabs your commit messages automatically, which saves tons of time. You can even check PR status with gh pr view without leaving terminal.

yeah gh pr create is solid but you can skip the interactive stuff with --title and --body flags. way faster when you already know what you want in the PR description