Making a pull request from your command line

Making a pull request from your command line

Β·

2 min read

Featured on Hashnode

The long-awaited feature is here, making a pull request from your command line. From now on, never leave your terminal.

With the Github CLI, this feature makes life easier than it was yesterday.

Forget everything, just open your command line and type...

Wait! you may have to download the Github CLI because you don't itπŸ˜‰πŸ˜‰.

Okay, let's continue... eh! you still need to install it.

...open your command line and type (make sure you do this in a git repository)

gh -v

you'll know if it is working.

Login and authentication

Before you make a pull request or stuffs like that, you really need to login to your Github account from the Github CLI with

gh auth login

Follow the instructions from Github CLI.

  • If you're logging in from the browser:
  • Copy out your one-time code.
  • Go to the browser, authorize Github CLI.
  • Input the one-time code when it is required.
  • Complete the process and return to your command line.
  • Choose default git protocol SSH or HTTPS Now you are done with authentication

First Pull Request

 gh pr create

This will create a pull request from your current branch into the default branch

It will give you instructions for creating a PR title, body, and metadata(which is optional).

When you are done, choose submit to complete the process and send a Pull Request.

Congratulations on not leaving your terminal πŸŽ‰πŸŽ‰πŸš€πŸš€πŸš€