GitHub CLI brings GitHub to the terminal. This is great news for all who like to use the terminal. GitHub CLI offers the following benefits without having you to leave the command line
- Easy creation of repositories.
- Easy creation of Pull requests.
- Easy approval of Pull requests.
- Easy checking of issues raised.
Let’s discuss some of the main commands.
Installation for Mac and Windows: https://cli.github.com/manual/installation
Installation for linux: https://github.com/cli/cli/blob/trunk/docs/install_linux.md
gh auth login: gh command for login.This will prompt for mode of login. I choose using a personal access token. The token can be generated by login to https://github.com/settings/tokens. Once the token is validated it shows a success message.
gh repo create <repo name>: This command will create repository in remote and local.
gh issue status: This command lists all the issues in GitHub. As a output it shows
- All the issues that are assigned to current user
- All the issues in which name of current user is mentioned
- All the tickets that are opened by current users
gh pr create: This command creates a new PR. While we create PR, the current local branch will be the source branch and the target branch will be the default branch. If we want to specify extra details we can pass them as an optional argument
- - a, - - assignee login : Assign people by their login
- -B, - - base branch: The branch into which you want your code merged
- -H, - - head branch: The branch that contains commits for your pull request (default: current branch)
For more information you can refer to the official documentation
gh pr diff : We can see PR changes using this command
gh pr merge: This command merge the pr request. We can choose whether the local branch need to delete or not
You can refer all the gh command using this link https://cli.github.com/manual/