Skip to content
Youngho Chaa cha cha
TwitterHomepage

Github CLI

github, CLI2 min read

GitHub CLI is a command-line tool that brings GitHub functionality to your terminal, allowing you to interact with repositories, issues, pull requests, and more without leaving the command line. It is designed to make it easier for developers to work with GitHub in their development environment.

Here's a brief introduction to GitHub CLI and some examples of common actions:

Installation:

brew install gh

Authentication:

To start using GitHub CLI, you'll need to authenticate with your GitHub account. Run the following command and follow the prompts:

gh auth login

Creating a repository:

To create a new repository on GitHub, use the gh repo create command:

gh repo create <repository_name>

This command will create a new repository under your account with the specified name. You can also add flags like --private to make the repository private or --description to add a description.

Cloning a repository:

To clone an existing GitHub repository to your local machine, use the gh repo clone command:

gh repo clone <repository_owner>/<repository_name>

Creating an issue:

To create a new issue in the current repository, use the gh issue create command:

gh issue create --title "Issue title" --body "Issue description"

Listing issues:

To list issues in the current repository, use the gh issue list command:

gh issue list

You can also filter the list by assignee, label, milestone, or state using flags like --assignee, --label, --milestone, and --state.

Creating a pull request:

To create a new pull request, use the gh pr create command:

gh pr create --title "Pull request title" --body "Pull request description"

This command will create a new pull request for the currently checked-out branch.

Checking out a pull request:

To check out a specific pull request locally, use the gh pr checkout command:

gh pr checkout <pull_request_number>

Merging a pull request:

To merge a pull request, use the gh pr merge command:

gh pr merge <pull_request_number>

This command will merge the specified pull request into the base branch

© 2024 by Youngho Chaa cha cha. All rights reserved.
Theme by LekoArts