13

Don't forget about the GitHub Command Line

 3 years ago
source link: https://www.hanselman.com/blog/dont-forget-about-the-github-command-line
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Don't forget about the GitHub Command Line
Sponsored By

I spend so much time at the command line using the Windows Terminal. Then I spend a ton of time using git at the command line. But then I ALT+TAB over to GitHub and mess around in the browser.

Why have I been sleeping on the GitHub CLI? - there's a command line interface for GitHub!

I installed with "winget install GitHub.cli" but you can get it from https://cli.github.com if you like.

Then you run gh auth login once:

gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser

Now you've got a new command "gh" to play with!

I went over to one of my local git clones for the Hanselminutes Podcast website and I can now list the open Pull Requests from the command line!

Open PRs on GitHub

Here's the real time saver that Dan Wahlin reminded me about: gh repo create!

> git init
Initialized empty Git repository in D:/github/ghcliblogpost/.git/
> gh repo create
? Repository name ghcliblogpost
? Repository description This is a test for my GH CLI Blog post
? Visibility Public
? This will add an "origin" git remote to your local repository. Continue? Yes
✓ Created repository shanselman/ghcliblogpost on GitHub
✓ Added remote https://github.com/shanselman/ghcliblogpost.git

Fantastic! You can even gh issue create!

gh issue create

Creating issue in shanselman/hanselminutes-core

? Title This is a test issue
? Body <Received>
? What's next? Submit
https://github.com/shanselman/hanselminutes-core/issues/219

Checking out a Pull Request is a great time saver as well. Go check out http://cli.github.com/ and see how it can help you today!


Sponsor: Protect your apps from reverse engineering and tampering with PreEmptive, the makers of Dotfuscator. Dotfuscator has been in-the-box with Microsoft Visual Studio since 2003. Visit preemptive.com/hanselminutes for a professional-grade trial.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK