5 Quick GitHub CLI Tricks to Speed Up Your Development Workflow

Context switching is one of the most persistent drains on developer productivity. Every time you leave your terminal to open a browser, authenticate through a dashboard, click through repository menus, and return to your code editor, your focus fractures. Git handles local version control with ruthless efficiency, yet interacting with GitHub itself—reviewing pull requests, managing issues, monitoring CI/CD pipelines, and tweaking release tags—traditionally pulled engineers away from their command-line comfort zones.

The official GitHub CLI (gh) bridges that gap. By bringing GitHub’s platform primitives straight to your terminal, it enables seamless workflow continuity. While many engineers install gh simply to clone repositories or open web links, the tool offers far deeper capabilities. Here are 5 quick, high-impact GitHub CLI tricks designed to streamline your daily workflow, eliminate browser hops, and save hours of administrative overhead every week.

1. Supercharge Pull Request Creation and Checkouts

Creating and inspecting pull requests usually involves pushing a branch, hunting down the generated URL, loading the GitHub web interface, filling out forms, and requesting reviewers. The GitHub CLI condenses this entire dance into single, declarative commands executed where your code already lives.

Instead of manually copying titles and commit descriptions into a web form, leverage automated flag options when creating pull requests:

# Create a PR using the first commit's subject and body
gh pr create --fill

# Create a PR interactively with specific reviewers and labels assigned
gh pr create --title "feat: implement redis caching" --body "Resolves cache stampede under peak load." --reviewer octocat,team-lead --label "enhancement,backend"

The --fill flag is especially powerful for atomic branches; it automatically inspects your commit history and uses your commit messages to populate the PR title and description. If your branch has multiple commits, gh pr create opens your configured terminal text editor (like Vim or Nano) pre-populated with a list of those commits.

Reviewing a teammate’s pull request is equally streamlined. Instead of manually fetching remote branches and configuring tracking pointers, use:

# Fetch remote changes and switch directly to PR #142
gh pr checkout 142

This command inspects the target pull request, determines whether it originates from the root repository or an external fork, configures the tracking reference locally, and checks out the branch instantly. You can then run tests, compile binaries, and even post a review comment or approve the pull request without ever leaving your terminal:

# Review and approve a pull request directly
gh pr review 142 --approve --comment "Clean implementation, performance metrics look solid."

2. Triage and Manage Issues Interactively

Filing bugs, checking sprint milestones, and tracking assigned tasks from the browser inevitably leads to tab clutter and distraction. The GitHub CLI turns your shell into a fast, keyboard-driven issue management dashboard.

To inspect your immediate workload across the current repository, query your assigned tickets using filter flags:

# List open issues assigned to you in the current repository
gh issue list --assignee "@me" --state open

# Filter issues by specific labels and milestones
gh issue list --label "p0,bug" --milestone "v2.4.0"

When you encounter a bug or technical debt item mid-coding session, switching context to report it often breaks your train of thought. You can quickly log an issue with precise context straight from your terminal:

# File an issue with metadata attached
gh issue create --title "fix: memory leak in worker pool" --body "Occurs when workers receive malformed JSON payloads." --assignee "@me" --label "bug"

If your project enforces standardized Markdown issue templates, gh issue create detects them automatically. When run without flags, it launches an interactive prompt in your terminal asking which template you want to use, lets you step through field inputs, and opens your editor for markdown drafting.

For quick status updates, you can also view or close issues directly by reference number:

# Inspect full issue details and comments in the terminal
gh issue view 88

# Close an issue once resolved
gh issue close 88 --comment "Addressed via PR #92"

3. Build Powerful Custom Shortcuts with gh alias

Every development team has repetitive operational patterns. You might frequently inspect pull requests matching a specific label, list branches needing cleanup, or generate deployment summaries. The built-in gh alias engine allows you to define reusable shortcuts, combining multiple flags or piping outputs to external terminal utilities.

Aliases in the GitHub CLI mirror the power of native Git aliases, but they encompass GitHub platform APIs. To create a custom alias, use the gh alias set command:

# Shortcut to checkout a PR quickly
gh alias set co "pr checkout"

# Shortcut to view PR diffs with side-by-side pager
gh alias set pd "pr diff"

# Shortcut to list all open PRs authored by yourself
gh alias set myprs "pr list --author '@me' --state open"

Where aliases truly shine is shell mode. By prefixing your command with an exclamation mark (!), you instruct gh to evaluate the entire expression within your operating system’s subshell. This unlocks UNIX piping, environment variables, and shell tools like grep, fzf, or xargs:

# Create an alias that interactive-selects a PR using fzf and checks it out
gh alias set fz-pr '!gh pr list --limit 30 | fzf | awk "{print \$1}" | xargs gh pr checkout'

# Create a quick standup helper listing what you closed or merged recently
gh alias set standup '!gh pr list --author "@me" --state merged --limit 10 && gh issue list --assignee "@me" --state closed --limit 10'

You can audit, view, and remove aliases at any time:

# List all currently configured aliases
gh alias list

# Remove an alias you no longer use
gh alias delete fz-pr

4. Monitor CI/CD Workflows and Inspect Failed Logs

Waiting for CI checks to pass is a routine part of modern software engineering. The typical workflow involves pushing a branch, refreshing the GitHub Actions page, clicking into the workflow matrix, and waiting for green checkmarks. The GitHub CLI provides deep integration with GitHub Actions through the gh run command family.

Instead of watching browser spinners, you can track running pipelines in real time directly inside your shell:

# Watch the most recent workflow run interactively
gh run watch

The watch command attaches to active GitHub Actions jobs, rendering an updated terminal dashboard of running stages, durations, and status codes. When the build concludes, it exits with an audible chime or status code return, allowing you to chain notifications:

# Watch CI and send a system notification on completion (macOS example)
gh run watch && osascript -e 'display notification "CI Passed!" with title "GitHub Actions"'

When a test suite fails, diving into a massive multi-megabyte log file via a web browser is clumsy and slow. With gh run, you can parse only the failing steps directly into your terminal pager:

# Immediately view logs for failed steps in the latest run
gh run view --log-failed

# View logs for a specific run ID
gh run view 129482910 --log-failed

If an intermittent network timeout caused a transient failure, you can trigger a re-run without navigating away from your terminal:

# Re-run only failed jobs for a workflow run
gh run rerun 129482910 --failed

5. Query the GitHub API Directly with Built-in JQ Parsing

Engineers often need to write custom scripts to audit repositories, pull release metrics, fetch security advisories, or sync team membership. Using curl typically requires generating personal access tokens, handling authorization headers, managing rate limits, and parsing nested JSON payloads.

The gh api command bypasses this setup completely. It automatically inherits the terminal’s authenticated GitHub session, handles headers, respects enterprise endpoints, and includes a built-in JSON processor powered by jq syntax via the --jq flag.

For example, to retrieve all contributors to a repository and print only their usernames:

# Query the repository contributors endpoint and extract logins
gh api repos/:owner/:repo/contributors --jq '.[].login'

Notice the use of the placeholder tokens :owner/:repo. The GitHub CLI automatically replaces these placeholders with the organization and repository name corresponding to your current local Git directory, eliminating manual string replacements in automated shell scripts.

You can also execute GraphQL queries with complete safety, formatting the output into compact tabular structures using the --template flag or standard JSON selectors:

# Query the current user's unread notifications count
gh api notifications --jq 'length'

# Post a JSON payload directly via POST request
gh api repos/:owner/:repo/discussions \
  -X POST \
  -f title="Architectural Proposal: Migrating to gRPC" \
  -f body="Proposal details for upcoming RFC review cycle." \
  -F category_id=123456

Because the authentication token is handled transparently, these commands can be plugged directly into continuous integration scripts, pre-commit hooks, or local bash functions without exposing long-lived access tokens inside environment files.

Essential Bonus Configurations

To extract maximum utility from these tricks, spend two minutes configuring your global preferences for the GitHub CLI. By default, gh attempts to deduce your preferred editor and git protocol, but pinning them explicitly avoids unpredictable prompts:

  • Set your primary terminal editor: Ensure gh launches your favorite editor when composing pull request bodies or issue templates.
    gh config set editor "vim"   # or "code --wait", "nano", "nvim"
  • Lock down your default protocol: Specify whether operations clone via SSH or HTTPS across all subcommands.
    gh config set git_protocol ssh
  • Explore community extensions: You can extend gh by installing community-authored plugins with gh extension install, adding features like interactive dashboards (gh-dash) or copilot interfaces directly inside the tool.

Adopting the GitHub CLI is not about abandoning web interfaces entirely; it is about eliminating friction for daily, repetitive operations. By managing pull requests, triaging issues, configuring custom aliases, monitoring CI runs, and querying the API directly from your terminal, you maintain deep technical focus and significantly speed up your development cycle.

Looking to refine your developer toolkit and boost everyday productivity? Be sure to explore our other guides and practical tutorials in the General category for more actionable workflow optimizations.

Leave a Comment