HACKER Q&A
📣 strix_varius

When did GitHub replace standard Git commands with the “GitHub CLI?”


Today I went to check out a colleague's branch, and noticed the standard `git` one-liner has been replaced with a `gh` one-liner: `gh pr checkout 1234`. Underneath, there's some subtle advertising: "Work fast with our official CLI. _Learn more._"

This is of course useless to me, and to any other developer who prefers to use standard tooling rather than proprietary lock-in stuff.

I don't begrudge Microsoft shipping a GH CLI as an optional thing, but shifting workflows away from the standard client is one of those changes that doesn't serve users, but rather serves some PM's KPIs.

EDIT: based on the "not on my machine" responses here, it's clear that I'm on some branch of an A/B test. These are the only three options now presented in my GH web UI - all the rest have disappeared (https://imgur.com/P7llsVo):

1. Checkout with the GitHub CLI

2. Checkout with GitHub Desktop

3. An ad for buying Codespaces for this public repo


  👤 qbasic_forever Accepted Answer ✓
For the very reason that you're still looking up how to checkout a pull request, git's CLI is not super intuitive and the gh tools appears to be trying to simplify it for their customers. Also realize that the entire concept of a pull request is foreign to git (it is a GitHub invention, Linus never designed git for pull request style development), so they likely want to add tooling to make it easier to use.

👤 clintonb
This post reads as unnecessary FUD. You aren’t forced to use the CLI. If you choose to use it, some workflows are simpler.

The only part of the commit response I care about is the URL to create/view a pull request. It’s pretty easy to ignore the rest.


👤 petepete
I love the gh tool. I still use `git switch` 95% of the time, but when a someone opens a PR on one of my repos being able to `gh pr checkout 123` is way easier than finding their fork, cloning and switching to the relevant branch.

The feature of gh I use most is `gh pr create`. It lets me combine the pushing of my current branch with creating a PR, allowing my to type the description using my text editor and has a nice interface for adding on reviewers etc. There's even a 'continue in a browser' button at the end if you want to add some screenshots.

It's an outstanding tool.


👤 Thristle
Just checked to see if I just missed it when i use GH

when cloning a repo you get 3 tabs instead of 2 before which are HTTPS,SSH,GH CLI

based on the gh command you wrote you were trying to checkout a branch related to a PR so i tried that on top there is now the `Checkout with github CLI` section but underneath it there is `Checkout with Git` with the HTTPS or SSH options

yes, they changed the layout and put their CLI on top (which came before microsoft btw, unrelated to them) but there is still the original workflow right there

Either OP is on some A/B bucket where they "deleted" git or OP didn't bother to look


👤 goku12
I just tried it now. The default is still HTTPS when signed out and SSH when signed in. The `gh` workflow seems to be the default only for those who have authenticated using the tool.

👤 tjpnz
Embrace. Extend. Extinguish.

👤 nfinished
It's tiring how reactionary the average HN commentor/contributor can be. It's not a replacement for standard git commands, it's a set of tools for interacting with GitHub. There are other commands for interacting with repos in GitHub specific ways so leaving out cloning a GitHub repo would have felt like a strange omission. Of course they're going to promote their own tool on their own website, that is generally how businesses work. You don't have to use it, no one is making you use it.

👤 rychco
It's not a replacement for git. I used the github cli recently to search for all repos in a specific language, above a certain star count, no archives, & no forks; then piped it into other commands to clone, rename, and archive the repos. It's a very convenient way to interact with github features without visiting the site in a browser.

👤 bminor13
> shifting default workflows away from the standard client is one of those changes that doesn't serve users

There is no "default workflow" for git - Git can be used in a variety of ways; everyone has their own personal preference, and some of these workflows are shaped by interacting with systems like Github/Gerrit/etc.

Every place I've ever worked at has either:

  - a home-grown wrapper around git to make common operations easy
  - a recommended set of git aliases around common operations
The fact that Github has created their own to interact with their own system is a net win for individuals/organizations who would otherwise need to spend time scripting their own.

Of all the capabilities of the Github CLI, `gh pr checkout` is the only one I use, because it makes it easy to fetch a PR locally by ID without configuring a remote per fork. I'm pretty glad I didn't have to write this myself.


👤 xg15
> Today I went to check out a colleague's branch, and noticed the standard `git` one-liner has been replaced with a `gh` one-liner: `gh pr checkout 1234`

Wait, I'm a bit confused. Where you on the "branch" or on the "pull request" UI? If they replaced the instructions to check out an arbitrary branch, I could understand the outrage. But this looks like a command to check out a pull request. To my knowledge, there is no standard git command to do this. (Because "pull requests" are a github/gitlab/etc concept not a git concept as the sibling comments explained)

If they just added instructions for the github client for things you can't do with the normal git CLI, that seems perfectly reasonable to me.


👤 _ache_
I not sure to understand but GH CLI is a free software (MIT License). If you already use Github, there is no more proprietary software.

https://github.com/cli/cli


👤 karmakaze
I'd heard of GitHub Desktop, didn't know about GH CLI. Don't use either, nor the git/GitHub IDE integration other than 'blame' to show commit hashes/dates on lines. Also use IDE to do 3-way diff conflict resolution, but initiate/commit/continue from command-line.

Do all git mutations from command-line using `git`.

One useful tip is that you can go to github.com//pull/ rather than PR# and it will redirect.


👤 paweladamczuk
Golly, are we in the extinguish phase already?

👤 raydiatian
A/B testing is the worst. YouTube tried out the idea of going straight from app-load into their TikTok mode (or whatever it’s called) on me a handful of times. I had a feeling they were collecting as much data as possible so every time I just uninstall the app for 24 hours. “Bad dog, no treat.”

👤 LinuxBender
The only odd thing I am seeing is network congestion on their side. It seems the bog standard git tool is working as expected for me. I am not seeing any advertisements for a new tool.

👤 secretsatan
As a sub menu from the "<> Code" Button? I have 3 tabs, HTTPS, SSH and this new Github CLI tab, but it remembers the last tab selected and always shows that

👤 a2tech
Microsoft 101--embrace, extend, extinguish. We've seen the GitHub embrace step, now we're seeing the extend part, next comes the lock in and closing off of GitHub.

👤 Cthulhu_
Nothing that can't be fixed with a browser addon, or using a local client or terminal commands to figure out what to put into a `git checkout`.

👤 xg15
I do hope the endgame isn't to get rid of git completely and switch tge repos to some proprietary format.

👤 thiago_fm
I've never used it