开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
今日推荐开源项目:《机器学习 PyTorch》
今日推荐英文原文:《Say Hello to the New GitHub CLIs》

今日推荐开源项目:《机器学习 PyTorch》 传送门:GitHub链接
推荐理由:PyTorch 是一个开源的、基于 Python 的可续计算包,提供两个高级功能:具有强大的GPU加速的张量计算(如NumPy),和包含自动求导系统的的深度神经网络。
今日推荐英文原文:《Say Hello to the New GitHub CLIs》 作者:Calvin Nguyen
原文链接:https://medium.com/better-programming/say-hello-to-the-new-github-clis-7e2612fb3918
推荐理由:顾名思义,本文介绍了一些使用 Git Hub CLI 的方法。如果你是 Git Hub 的忠实用户但是又觉得网页和终端转换繁琐的话,不妨试试这个吧。

Say Hello to the New GitHub CLIs

All you need to know about using GitHub from your terminal

(Source by Github)
GitHub tools are all great, but sometimes, I get exhausted as I’m coding and have to switch from my terminal/text editor to do many clicks in the browser, just to create or view a PR.

Luckily, on March 6th, 2020, GitHub released a new cool GitHub CLI, with which you can do everything you do on github.com on your local terminal. There are three main commands in this beta version that I will discuss below:

  1. Issue
  2. Pull Request (PR)
  3. Repo

macOS: Easy Install With brew

brew install github/gh/gh

Upgrade

brew update && brew upgrade gh

Windows

gh is available via Scoop:
scoop bucket add github-gh https://github.com/cli/scoop-gh.git
scoop install gh
For Linux and other platforms, please refer to this GitHub page.

1. gh issue [create, list, view, status]

Create an issue

~/Documents/MyProject (master)$ gh issue create
Creating issue in calvinqc/MERN-template
? Title Deployment To Google App Engine
? Body <Received>
? What's next? Submit
https://github.com/calvinqc/MERN-template/issues/1
Or, if you still prefer editing in the browser, quickly enter:
$ gh issue create --web

List all issues

$ gh issue list
Issues for calvinqc/MERN-template

#1  Deployment To Google App Engine

View an issue

$ gh issue view 1
Then, it will redirect me to the issue link. Or you can preview it in your local as well:
$ gh issue view 1 --preview

Status

$ gh issue status
Relevant issues in calvinqc/MERN-template
Issues assigned to you
  There are no issues assigned to you
Issues mentioning you
  There are no issues mentioning you
Issues opened by you
  #1 Deployment To Google App Engine about 9 minutes ago

2. gh pr [status, list, view, checkout, create]

Create a PR

~/Documents/project/MyProject (gh-testing)$ gh pr create
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 4 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 444 bytes | 444.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To github.com:calvinqc/MERN-template.git
   1c179cb..7953ecc  HEAD -> gh-testing
Branch 'gh-testing' set up to track remote branch 'gh-testing' from 'origin'.
Creating pull request for gh-testing into master in calvinqc/MERN-template
? Title Change sha256 to bcrypt
? Body <Received>
? What's next? Submit
https://github.com/calvinqc/MERN-template/pull/2
As you can see, if there’s one thing that I love about gh pr create, it is that it will push your commit to your working branch and create a PR within a few seconds.

List/view/status with PR (same with the issue)

$ gh pr list
Pull requests for calvinqc/MERN-template
#2  Change sha256 to bcrypt  gh-testing
$ gh pr view 2
Opening https://github.com/calvinqc/MERN-template/pull/2 in your browser
$ gh pr status
Relevant pull requests in calvinqc/MERN-template
Current branch
  #2  Change sha256 to bcrypt [gh-testing]
   - Checks passing
Created by you
  #2  Change sha256 to bcrypt [gh-testing]
   - Checks passing
Requesting a code review from you
  You have no pull requests to review

Checkout a PR

This is very similar to a regular branch checkout.
$ gh pr checkout 2

3. gh repo [clone, create, fork, view]

Clone a repo

$ gh repo clone [email protected]:calvinqc/MERN-template.git

Create/view a repo

$ gh repo create gh-cli-is-awesome
$ gh repo view calvinqc/gh-cli-is-awesome
Opening github.com/calvinqc/gh-cli-is-awesome in your browser.

Fork a repo

$ gh repo fork calvinqc/MERN-template

Future Improvement

Since this is still in beta version and I have not found any bugs yet, I believe that these cool Git CLIs will help improve productivity for many developers.

That’s it for this beta version. It makes my development better, and I like it!

With GitHub CLIs; less clicking, more typing — the more productive I am.

Thanks for reading and I hope it makes you feel happier!


下载开源日报APP:https://openingsource.org/2579/
加入我们:https://openingsource.org/about/join/
关注我们:https://openingsource.org/about/love/