DEV Community

Maria Nanfuka
Maria Nanfuka

Posted on

Using GitHub CLI v1.0

Github CLI v1.0 has been released and is available for download on Linux, MacOS, Windows machines

With Github CLI v1.0, you are able to:

  • run entire github workflow from the terminal
  • set a custom alias for any command
  • connect to github enterprise server 2.20+

Installation/Setup

MacoS
brew install gh
Enter fullscreen mode Exit fullscreen mode
Linux
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
Enter fullscreen mode Exit fullscreen mode
Windows
  • via scoop
scoop bucket add github-gh https://github.com/cli/scoop-gh.git
scoop install gh
Enter fullscreen mode Exit fullscreen mode
  • via chocolatey
choco install gh    
Enter fullscreen mode Exit fullscreen mode

Managing Github repository using github cli

  • Initialize private repository
gh repo create <name>
Enter fullscreen mode Exit fullscreen mode
  • Initialize a public repository
gh repo create <name> --public
Enter fullscreen mode Exit fullscreen mode
  • Clone remote repository
gh repo clone <repository-url>
Enter fullscreen mode Exit fullscreen mode
  • Fork repository
gh repo fork
Enter fullscreen mode Exit fullscreen mode

Managing Pull requests using github cli

  • Create pull request
gh pr create
Enter fullscreen mode Exit fullscreen mode
  • Checkout pull request
gh pr checkout {<pull request number> | <url> | <branch>} [flags]
Enter fullscreen mode Exit fullscreen mode
  • View the Diff
gh pr diff
Enter fullscreen mode Exit fullscreen mode
  • Check all tests are passing
gh pr checks
Enter fullscreen mode Exit fullscreen mode
  • Merge pull request
gh pr merge
Enter fullscreen mode Exit fullscreen mode

Manage Aliases with github cli

  • Create aliases
gh alias set
Enter fullscreen mode Exit fullscreen mode
  • Share your aliases with a gist
gh alias list | gh gist create
Enter fullscreen mode Exit fullscreen mode

Manage Issues with github cli

  • Create a new issue
gh issue create
Enter fullscreen mode Exit fullscreen mode
  • List issue
gh issue list
gh issue list --state closed
Enter fullscreen mode Exit fullscreen mode
  • View status of issue
gh issue status
Enter fullscreen mode Exit fullscreen mode

Resources

Top comments (0)