logoalt Hacker News

mghackerladytoday at 1:03 PM6 repliesview on HN

can someone explain why github has a CLI? why wouldn't you just use git?


Replies

cervedtoday at 1:27 PM

You use gh to interact with the forge, git to interact with the repo.

For example

  gh pr checks --watch
will run and poll the CI checks of a PR and exit 0 once they all pass
Atreidentoday at 1:08 PM

Creating PRs, reading PRs, creating/reading Issues, triggering actions, to name a few

none2585today at 1:10 PM

My last job they used gh features heavily - pull requests, issues, and gha most of all. So having the cli made automating (or interacting with agents) github-specific tasks possible.

koito17today at 2:07 PM

At my current job, I sometimes set up a Nix shell with the GitHub CLI, since that let's Claude Code associate a feature branch to a pull request. The LLM can then retrieve PR description, workflow results, review comments, etc.

Also, I believe GitHub Actions cache cannot be bulk deleted outside of the CLI. The first time I [hesitantly] used the gh CLI was to empty GitHub Actions cache. At the time it wasn't possible with the REST API or web interface.

chris_money202today at 1:07 PM

gh is insanely powerful, especially if you let your coding agent use it. It’s one of my top tools. Gh lets you use GitHub features such as issues, pull request, reading CI pipelines, creating CI pipelines, etc. git is just for code version control.

bakiestoday at 1:06 PM

PRs, and managing repos, and other things that aren't git features. You can use it to auth with GITHUB_TOKEN instead of ssh or http. Which is how my agents get access. I've switched to gitea, it's got all the same features.

show 1 reply