Don't forget about the GitHub Command Line
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!
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
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.
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
It would be great to have a single command to create a pull request, as an example..
As a developer, you might work today with a project on GitHub, after one year on another that is using Azure DevOps etc.
@Peter I have no notes online (a chronic backlog item), but I believe this page was helpful a few years ago: https://john.albin.net/git/convert-subversion-to-git
Comments are closed.