探索新的GitHub CLI

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

GitHub最近宣布了其新的CLI产品。 cli.github.com

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工作。 这不仅仅是pushpull而且不直接绑定到Git命令行工具。 它也与GitHub的Hub CLI工具不同

GitHub CLI Beta

GitHub CLI测试版

安装GitHub CLI ( Installing the GitHub CLI )

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

有适用于Windows,Mac和Linux的安装程序 。 如果您使用的是Mac,则可以使用Homebrew通过以下方式进行安装:

brewinstall github/gh/gh

GitHub CLI可以做什么? ( 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:

GitHub CLI作为团队开发人员专注于我们的工作流程。 这是我们可以从命令行执行的GitHub CLI功能的快速列表:

  • 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

    拉取请求:
    • 结帐PR
    • 建立公关
    • 列出所有PR(和过滤器)
    • 查看PR的状态(和过滤器)
    • 查看一个公关

gh和hub有什么区别? ( What is the difference between gh and hub? )

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

gh和hub都将继续工作。 从GitHub CLI自述文件中

"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工具。gh是我们的一个新项目,旨在探索具有根本不同设计的正式GitHub CLI工具的外观。虽然这两个工具都将GitHub带到了终端,但集线器的行为就像一个git和gh的代理是一个独立工具。”

  • GitHub CLI Features include Issues and Pull Requests

    GitHub CLI功能包括问题和拉取请求
  • hub Features include cloning/creating repos

    集线器功能包括克隆/创建存储库

使用GitHub CLI处理问题 ( 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}

创建问题 (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

使用GitHub CLI处理拉取请求 ( Working on Pull Requests with the GitHub CLI )

签出拉取请求 (Checkout a Pull Request)

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

# example
# gh pr checkout 12

创建拉取请求 (Creating a Pull Request)

ghpr 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)

ghpr 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")

显示拉取请求的状态 (Show the Status of Pull Requests)

ghpr status [flags]

查看一个请求请求 (View a Single Pull Request)

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

# example
# gh pr view 14

结论 ( Conclusion )

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

GitHub CLI应该可以帮助那些在仓库上工作的人解决很多问题和PR。

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

GitHub CLI仍处于早期阶段,因此如果您想提供帮助, 给他们反馈: https : //forms.gle/umxd3h31c7aMQFKG7

翻译自: https://scotch.io/tutorials/exploring-the-new-github-cli

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值