Exploring the New GitHub CLI

栏目: IT技术 · 发布时间: 6年前

内容简介:GitHubIt allows us to do GitHub work directly from the command line. This is more than just

GitHub recently announced their new CLI offering. cli.github.com

Table of Contents

  • Installing the GitHub CLI
  • What can the GitHub CLI do?
  • What is the difference between gh and hub?
  • Working on Issues with the GitHub CLI
  • Show the Status of Issues
  • Working on Pull Requests with the GitHub CLI
  • Checkout a Pull Request
  • Creating a Pull Request
  • List All Pull Requests
  • Show the Status of Pull Requests
  • View a Single Pull Request

It allows us to do GitHub work directly from the command line. This is more than just push or pull and is not tied directly to the Git command line tools. It is also not the same as GitHub’s hub CLI tool .

GitHub CLI Beta

Installing the GitHub CLI

There are installers for Windows, Mac, and Linux. If you are on Mac, you can use Homebrew to install using:

brew install github/gh/gh

What can the GitHub CLI do?

The GitHub CLI is focused on our workflows as team developers. Here’s a quick list of GitHub CLI features that we can do from the command line:

  • Issues:
    • Create an issue
    • List all issues (and filter)
    • See status of an issue (and filter)
    • View a single issue
  • Pull Requests:
    • Checkout a PR
    • Create a PR
    • List all PRs (and filter)
    • See status of a PR (and filter)
    • View a single PR

What is the difference between gh and hub?

gh and hub will both continue to work. From the GitHub CLI README :

"For many years, hub was the unofficial GitHub CLI tool. gh is a new project for us to explore what an official GitHub CLI tool can look like with a fundamentally different design. While both tools bring GitHub to the terminal, hub behaves as a proxy to git and gh is a standalone tool."

  • GitHub CLI Features include Issues and Pull Requests
  • hub Features include cloning/creating repos

Working on Issues with the GitHub CLI

Showing All Issues

gh issue list [flags]

# flags can be:
# -a, --assignee string   Filter by assignee
# -l, --label strings     Filter by label
# -L, --limit int         Maximum number of issues to fetch (default 30)
# -s, --state string      Filter by state: {open|closed|all}

Exploring the New GitHub CLI

Creating an Issue

gh issue create [flags]

# flags can be:
# -b, --body string    Supply a body. Will prompt for one otherwise.
# -t, --title string   Supply a title. Will prompt for one otherwise.
# -w, --web            Open the browser to create an issue

Show the Status of Issues

gh issue status [flags]

# flags can be:
# --help                  Show help for command
# -R, --repo OWNER/REPO   Select another repository using the OWNER/REPO format

View a Single Issue

gh issue view {<number> | <url> | <branch>} [flags]

# example
# gh issue view 8

# flags can be:
# -p, --preview   Display preview of issue content

Working on Pull Requests with the GitHub CLI

Checkout a Pull Request

gh pr checkout {<number> | <url> | <branch>} [flags]

# example
# gh pr checkout 12

Creating a Pull Request

gh pr create

# flags can be:
# -B, --base string    The branch into which you want your code merged
# -b, --body string    Supply a body. Will prompt for one otherwise.
# -d, --draft          Mark pull request as a draft
# -t, --title string   Supply a title. Will prompt for one otherwise.
# -w, --web            Open the web browser to create a pull request

List All Pull Requests

gh pr list [flags]

# flags can be:
# -a, --assignee string   Filter by assignee
# -B, --base string       Filter by base branch
# -l, --label strings     Filter by label
# -L, --limit int         Maximum number of items to fetch (default 30)
# -s, --state string      Filter by state: {open|closed|merged|all} (default "open")

Exploring the New GitHub CLI

Show the Status of Pull Requests

gh pr status [flags]

View a Single Pull Request

gh pr view [{<number> | <url> | <branch>}] [flags]

# example
# gh pr view 14

The GitHub CLI should help those out who work on repos with a lot of issues and PRs.

The GitHub CLI is still in early stages so give them feedback if you want to help out: https://forms.gle/umxd3h31c7aMQFKG7

Like this article? Follow @chrisoncode on Twitter


以上所述就是小编给大家介绍的《Exploring the New GitHub CLI》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

禅与摩托车维修艺术

禅与摩托车维修艺术

(美)罗伯特·M.波西格 / 张国辰 / 重庆出版社 / 2011-9 / 36.00元

在一个炎热的夏天,父子两人和约翰夫妇骑摩托车从明尼苏达到加州,跨越美国大陆,旅行的过程与一个青年斐德洛研修科学技术与西方经典,寻求自我的解脱,以及探寻生命的意义的过程相互穿插。一路上父亲以一场哲学肖陶扩的形式,将见到的自然景色,野外露营的经历,夜晚旅店的谈话,机车修护技术等等日常生活与西方从苏格拉底以来的理性哲学的深入浅出的阐述与评论相结合,进行了对形而上学传统的主客体二元论的反思,以及对科学与艺......一起来看看 《禅与摩托车维修艺术》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码