GitHub CLI

Advertisement

Do everything from Terminal or Command Prompt with GitHub CLI.

GitHub CLI is Free and open source.

Installation Installation

We can install the GitHub CLI in various ways. I’m using the custom installation for Windows operating system in which I use the MSI file gh_1.0.0_windows_amd64.msi which is now in 5.84 MB.

For other installation process Visit https://github.com/cli/cli#installation

Downlaod the MSI version which is supported by your windows operating system.

  • Click on gh_1.0.0_windows_amd64.msi to Downlaod
  • Click on Install

Top ↑

Authentication Authentication

  • Use command gh auth login
  • Select GitHub.com or GitHub Enterprise Server and press enter
  • Select Login with web browser or Paste an authentication token
  • Enter the token

313A-1A69

9A85-0C0A

Protocol: HTTP / SSH
https://i.imgur.com/u2fZLhX.png

DONE

Top ↑

Here, I have clone the Gutenberg reposotory in my WordPress setup. So, I’m showing few GitHub CLI commands with Gutenberg repo.

Top ↑

PR list PR list

Type gh pr list

Top ↑

Checkout to PR. Checkout to PR.

Use gh pr checkout <ID>

E.g. gh pr checkout 25419

Top ↑

Issue List Issue List

gh issue list

Top ↑

See issue See issue

Use gh issue view <ID>

E.g. gh issue view 25437

See issue on browser with --web flag.

E.g. gh issue view 25437 --web

Top ↑

Create new Repo Create new Repo

mkdir github-cli-example

cd github-cli-example

git init

Use gh repo create

$ gh repo create
? Repository name github-cli-example   
? Repository description 
? Visibility Public                               
? This will create 'github-cli-example' in your current directory. Continue?  Yes   
✓ Created repository maheshwaghmare/github-cli-example on GitHub
✓ Added remote https://github.com/maheshwaghmare/github-cli-example.git

Create a README.MD as

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ touch README.md

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ code README.md

I have added the below line in Readme.md file.

# This Repository Created with GitHub CLI command.

Now add changes in github.

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ git add .

Commit changes

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ git commit -m "Initial commit."
[master (root-commit) 2b2938a] Initial commit.
 1 file changed, 1 insertion(+)
 create mode 100644 README.md

Push changes

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 266 bytes | 133.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/maheshwaghmare/github-cli-example.git
 * [new branch]      master -> master

Now after visiting to https://github.com/maheshwaghmare/github-cli-example we can see:

%d bloggers like this: