When starting a new project, I prefer to keep everything inside the terminal.
With GitHub CLI (gh), I can create repositories, manage issues, and handle pull requests — all without touching the GitHub website.
Here’s how I use gh commands in my day-to-day work.
| Task | Command |
|---|---|
| Log in to GitHub | gh auth login |
| Check login status | gh auth status |
| Create a new repo in current folder | gh repo create |
| List open issues | gh issue list |
| Create an issue | gh issue create |
| Develop an issue locally | gh issue develop <issue-number> -c |
| Create a pull request | gh pr create |
| Merge a pull request | gh pr merge <number> |
If you haven’t installed GitHub CLI yet, follow the official setup guide here:
👉 Install GitHub CLI
Start by logging in:
gh auth loginYou can choose SSH or HTTPS for authentication.
To check your current status:
gh auth statusAnd to sign out:
gh auth logoutWhen creating a new Next.js project, I use:
pnpm create next-app@latest my-project
cd my-projectThen, inside the project directory:
gh repo createGitHub CLI automatically detects the current folder and guides you through an interactive setup — such as choosing visibility and initial settings.
Once complete, your project is linked to a new GitHub repository instantly.
You can view your repositories directly in the terminal:
gh repo listAdd options like --limit 10 to show only a few results.
You can check, view, and create issues without leaving your terminal.
| Purpose | Command | Example |
|---|---|---|
| List open issues | gh issue list | gh issue list --label enhancement |
| View issue details | gh issue view <number> | gh issue view 27 --web |
| Create a new issue | gh issue create | gh issue create |
| Develop an issue locally | gh issue develop <issue-number> -c | gh issue develop 42 -c |
The develop command lets you spin up a new branch and start working on an issue immediately.
The -c flag automatically checks out that branch after it’s created — great for jumping straight into development.
Creating and managing pull requests is seamless with GitHub CLI.
| Purpose | Command | Example |
|---|---|---|
| List pull requests | gh pr list | gh pr list --state open |
| View a pull request | gh pr view <number> | gh pr view 12 --web |
| Create a new pull request | gh pr create | gh pr create |
| Checkout a pull request locally | gh pr checkout <number> | gh pr checkout 12 |
| Merge a pull request | gh pr merge <number> | gh pr merge 12 --squash |
| Close a pull request without merging | gh pr close <number> | gh pr close 12 |
If you’re not sure what’s available, explore with:
gh helpOr view details for specific sections:
gh repo --help
gh pr --helpGitHub CLI keeps your workflow smooth and focused.
From creating new repositories to managing issues and pull requests, it lets you stay entirely within the terminal — no browser required.