Take GitHub to the command line
Using Git locally and exiting the terminal each time to check the status on the GitHub web app is really cumbersome. To solve this issue GitHub has come up with a command-line tool-GitHub CLI which will allow the users to run an entire GitHub workflow from their terminal.
We can use the “gh” command-line tool to interact with the hosted projects on GitHub and perform various other actions like looking at the issue list, making PRs, etc.
Installation
GitHub CLI beta version is available for macOS, Windows, and Linux.
Authentication
Run this command to authenticate your GitHub account
$ gh auth login
Choose the appropriate options and get started.
Clone a repository
Clone the repository you want to work with using
$ gh repo clone owner/repo
View issue list
To view the issue list for the repository use,
$ gh issue list
Creating a PR
After adding a new feature or correcting a bug you can create a PR use this command
$ gh pr create
Other commands for PR
- To check out the PR
$ gh pr checkout #PRno
- To view the difference
$ gh pr diff
- To review
# approve the pull request of the current branch
$ gh pr review --approve
# leave a review comment for the current branch
$ gh pr review --comment -b "interesting"
# add a review for a specific pull request
$ gh pr review 123
- To check if all test are passed after the PR is approved
$ gh pr checks
- To merge the PR
$ gh pr merge
That’s it from my side. I have covered some basic commands here.You can also refer the manual for more commands.I hope you enjoyed reading this article 😊.
If you want to get connected with me, please follow these links
Github-https://github.com/Sapna2001
LinkedIn-https://www.linkedin.com/in/sapna2001/
And if you have any suggestions, feel free to get in touch with me over LinkedIn & the comment section is also all yours.
If you liked this story, hit the clap button as it motivates me to write more & better.
Thanks for reading!!!!