Git and SSH

Open a pull request from the terminal

Push your branch and ask for it to be checked and merged, without leaving the terminal.

  1. Push your branch
    Terminal
    git push -u origin HEAD

    HEAD means the branch you're on now.

  2. Open the pull request
    Terminal
    gh pr create --fill

    Needs GitHub CLI, signed in. See “Install GitHub CLI and log in”. --fill uses your commit messages for the title and description. Leave it off and gh asks you for them.

Check it worked

  1. See it in your browser
    Terminal
    gh pr view --web
Undo it
  1. Close it without merging
    Terminal
    gh pr close

    Your branch and commits stay. You can reopen it later.

  1. Push your branch
    Terminal · Ubuntu / Debian
    git push -u origin HEAD

    HEAD means the branch you're on now.

  2. Open the pull request
    Terminal · Ubuntu / Debian
    gh pr create --fill

    Needs GitHub CLI, signed in. See “Install GitHub CLI and log in”. --fill uses your commit messages for the title and description. Leave it off and gh asks you for them.

Check it worked

  1. See it in your browser
    Terminal · Ubuntu / Debian
    gh pr view --web
Undo it
  1. Close it without merging
    Terminal · Ubuntu / Debian
    gh pr close

    Your branch and commits stay. You can reopen it later.

  1. Push your branch
    PowerShell
    git push -u origin HEAD

    HEAD means the branch you're on now.

  2. Open the pull request
    PowerShell
    gh pr create --fill

    Needs GitHub CLI, signed in. See “Install GitHub CLI and log in”. --fill uses your commit messages for the title and description. Leave it off and gh asks you for them.

Check it worked

  1. See it in your browser
    PowerShell
    gh pr view --web
Undo it
  1. Close it without merging
    PowerShell
    gh pr close

    Your branch and commits stay. You can reopen it later.

New to Pull request? I explain it in plain English on Layman Terms.