GitHub CLI: Brings GitHub to the Terminal

source: github blog

GitHub CLI brings GitHub to the terminal. This is great news for all who like to use the terminal. GitHub CLI offers the following benefits without having you to leave the command line

  • Easy creation of repositories.
  • Easy creation of Pull requests.
  • Easy approval of Pull requests.
  • Easy checking of issues raised.

Let’s discuss some of the main commands.

Installation for Mac and Windows:

Installation for linux:

gh auth login: gh command for login.This will prompt for mode of login. I choose using a personal access token. The token can be generated by login to Once the token is validated it shows a success message.

login steps

gh repo create <repo name>: This command will create repository in remote and local.

github before running create command
local before running create command
github after running create command
local after running create command

gh issue status: This command lists all the issues in GitHub. As a output it shows

  1. All the issues that are assigned to current user
  2. All the issues in which name of current user is mentioned
  3. All the tickets that are opened by current users
GitHub issue status

gh pr create: This command creates a new PR. While we create PR, the current local branch will be the source branch and the target branch will be the default branch. If we want to specify extra details we can pass them as an optional argument

  • - a, - - assignee login : Assign people by their login
  • -B, - - base branch: The branch into which you want your code merged
  • -H, - - head branch: The branch that contains commits for your pull request (default: current branch)

For more information you can refer to the official documentation

GitHub before running PR create command
gh pr create
GitHub after running PR create command

gh pr diff : We can see PR changes using this command

gh pr merge: This command merge the pr request. We can choose whether the local branch need to delete or not

git pr merge command
GitHub after running the merge command

You can refer all the gh command using this link




Coding, Reading,Python

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Interview with Seli!  — — — — — — —  Interview mit Seli!

Easter Eggs, but not as we know them

The Google search result for Joey Tribbiani with a hidden Easter Egg

iOS Continuous Deployment with Jenkins: A Brief Introduction

How to start learning or strengthen your knowledge of Data Structures and Data Science?

Nailing down the SOP Outline

Image with “You have been selected” written on it

Building an On-Site Cyber Range

Unreal Engine C++ Developer Class Progress Tracker Day 3

Reimagining The Enterprise Software Development Process

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Coding, Reading,Python

More from Medium

Oh-My-Zsh and Themes

Multiple git accounts on same machine

Play with GitHub Desktop for testers.

Command line improvements in PowerShell, WSL, Windows Terminal and VS Code