Ask HN: 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
80 comments
[ 2.4 ms ] story [ 139 ms ] threadEDIT: Never mind. OP was referring to checking out from the PR page, which does only show the GitHub CLI option.
[0]: https://imgur.com/S3gxl1x
[1]: https://imgur.com/P7llsVo
I've been using GH at work and personally for a while now and i never wanted/needed to use the GH CLI/GUI, the IDE will cover you if you need it to.
If they really removed the easy to use copy button it would be annoying but calling it "extinguish" is definetly some HN warrior attitude. They didn't remove it though, just moved it a bit and OP is being a bit dramatic
On the contrary, HN is great because most users stick to the subject of discussions rather than devolving into ad-hominem attacks.
It's curious that your account was created exactly one minute after this post was posted, for precisely one insulting comment.
- - - -
MS has a long long history, any animosity they receive is well-earned. E.g.:
> "Embrace, extend, and extinguish" (EEE),[1] also known as "embrace, extend, and exterminate",[2] is a phrase that the U.S. Department of Justice found[3] that was used internally by Microsoft[4] to describe its strategy for entering product categories involving widely used standards, extending those standards with proprietary capabilities, and then using those differences in order to strongly disadvantage its competitors. https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis...
> The strategy and phrase "embrace and extend" were first described outside Microsoft in a 1996 article in The New York Times titled "Tomorrow, the World Wide Web! Microsoft, the PC King, Wants to Reign Over the Internet",[5]
https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis...
It's now 2023; 27 years later.
Name a single thing Microsoft has EEE'd in the last 20 years. There isn't one. All the examples from the Wikipedia page are from the 90s or early 2000s at best (and most of those seem to be about lawsuits for things that happened a few years earlier). The only recent mention is about "Windows Subsystem for Linux", and those fears turned out to be entirely unwarranted.
Do I like Microsoft? Not especially; it's a large corporation that acts in its own self-interest in an a-moral way. But it's also no longer the Microsoft of the 90s. In fact, almost everything is different: leadership, employees, revenue stream, business model.
The laptop would not let me start to use it until I had activated Wi-Fi and connected a Microsoft account! It literally would not leave the init wizard until I had "phoned home" to the corporate cloud.
> Name a single thing Microsoft has EEE'd in the last 20 years.
See above.
- - - -
In reply to nfinished sib comment:
> "Ask HN: GitHub just added a feature I don't like to GitHub" is a conversation worth having?
So why are you?
Aside: I just have a Windows VM for testing, but I bypassed the account "requirement" for that by disconnecting from the internet when installing Windows.
Well then I don't know what to tell you. From my POV as a "Free" software fanatic* it all seems "of a piece": VS Code is a Trojan Horse, GitHub is insidious, etc.
(* I'm one of those who sees the "Open Source" movement as a distraction from the main point of the "Free" software movement, although I have to admit that most people haven't heard of either of them, and of those who have, most can't or don't distinguish them.)
I just don't see how "need Microsoft account to log in to Windows" even remotely fits that. I don't know of anything Microsoft has done in the last 20 or so years that fits that. I can tell you of specific things Microsoft has done in the last 20 years that I don't like, but that doesn't make it embrace, extend, and extinguish.
I think especially if you want to promote Free Software it's very important to keep a cool head and not get too clouded by past grievances. IMHO people are fighting yesterday's war with all of this to the detriment of today's war.
That sure sounds like gh vs git to me (the thing this thread is about.)
> I just don't see how "need Microsoft account to log in to Windows" even remotely fits that.
The have embraced and extinguished the very idea of owning your own computer. These laptops come configured as dumb terminals for their corporate cloud. They EEE'd the Dynabook yo!?
> I don't know of anything Microsoft has done in the last 20 or so years that fits that.
I'm sure there are examples of MS following their playbook over the last three decades, I'm not going to "google it for you", there are probably lists kept by people who care more than I do.
> I can tell you of specific things Microsoft has done in the last 20 years that I don't like, but that doesn't make it embrace, extend, and extinguish.
I feel like you're missing the forest for the trees. The EEE thing is a strategy or tactic to achieve the overall goal: getting between people and their hardware and "extracting rent". That's their whole thing, yeah?
GitHub acquisition, VS Code, etc. Everything they do is EEE, whether it looks like a sheep or a wolf, it's a wolf.
Incidentally, that's why I don't accept the "Ship of Theseus" idea that MS has turned over in the last few decades. The ship is still a ship.
> I think especially if you want to promote Free Software it's very important to keep a cool head and not get too clouded by past grievances.
That's what I'm saying: the very idea that these grievances are past is exactly what I have a problem with, because they're not past. If anything, MS is succeeding.
> IMHO people are fighting yesterday's war with all of this to the detriment of today's war.
Following the war metaphor, I think we (the Free software folks) have clearly lost completely. We have been roundly defeated. Most people have never heard of us, let alone know what we're even about.
The closest thing to a front in the "War of General Purpose Computing" is the farmers fighting the tractor companies for the right to repair their tractors now that they have computers in them.
In any event, well met. Cheers! :)
On at least three topics I've consistently found this to not be the case: Google, Microsoft, Cryptocurrency (also: Richard Stallman, suckless, but those come up less often).
I find that these threads often devolve pretty fast away from "the subject". I actually dislike all three of those things as well; I use none of their products save for GitHub and haven't for years. But that doesn't mean that everything these companies do is part of a sinister machiavellian plot to take over the world. And not everyone involved in crypto is a sociopathic scammer looking to steal your money, either, even though I think crypto overall is a net negative.
> It's curious that your account was created exactly one minute after this post was posted, for precisely one insulting comment.
I'm really not trying to "gotcha" here, but you're kind of proving my point with this remark.
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.
For years, it's been the default command in a single-click "copy" field under the "code" dropdown in a PR, not because git is complicated and anyone needs to "look up" the command, but because that's a fast and efficient way to grab a branch.
Replacing the `git` single-liner with a `gh` single-liner does nothing for the user but make them dependent on the `gh` tool.
I don't mind gh as an additional tool but OP's description suggests that Microsoft tries to replace git with gh entirely.
(Hint: there is none, only the gh tool and GitHub api know it)
gh pr checkout 123
That's just for convienance. It does a few things...
1) looks up the pull request to find the proper repository and branch on it.
2) adds the repository if not already added
3) checks out the branch the PR is based on
How would you do that with just git?
I see gh pr checkout as a convenience. It just makes it less work.
The entire reason I have "gh" on my system is to easily check out PRs and to set them up so I can push to them with a minimum of mucking about. I use it for noting else.
I do agree it would be nicer to also add the git commands (plural!), but I suspect they just didn't because it's multiple commands to get the same experience. That is: UI reasons, not anything sinister.
> proprietary "gh cli"
It's not "proprietary": https://github.com/cli/cli/blob/trunk/LICENSE
And as you can see in the output above, it's just a wrapper around some git commands. If you want to call this "proprietary" then you should also call tig, got, and other alternative interfaces to git "proprietary".
Fair. It is non-standard, published via Microsoft, and even named after the single product that it supports, but if we're splitting hairs it does technically have an open-source license. So I removed the term "proprietary."
The thing is, almost all of "gh" is an interface for GitHub: you can list issues, close issues, comment on issues, do all sorts of stuff with Actions, releases, your account", etc.
And oh, it can also do some limited stuff with git, kind of as an extra. Looking at the gh help output, the only commands are "gh repo {clone,sync}" and "gh pr {checkout,diff,merge}". I guess the repo clone/sync was added for completeness sake (other repo subcommands all relate to GitHub UI stuff), and gh pr is there because all of that is kind of non-trivial if you also want to be able to push to other people's PRs (not impossible or even difficult, just non-trivial and somewhat non-obvious).
In short, I think people are assuming a lot about all of this and there really isn't that much to see.
Only the first two are actually important though (the rest smell like an antifeature to me in fact). I have them both as a single `git pr <remote> <PR>` alias:
...and an equivalent for GitLab: You could easily hardcode remote to be "origin" and get what `gh` does.I believe without it you can't push to a PR? As a maintainer, I find it quite useful: if a PR is essentially fine but needs a minor/trivial edit (typo, maybe add a few lines of documentation, extremely minor code style changes) then I typically just make then myself as I don't want to bother the submitter for that. Faster and easier for me, faster and easier for them.
Either way, of course all of this is possible without the "gh" tool – no one claimed it's not, – but it's a lot easier than "stick these commands in your git config", especially for people not well versed in git.
Doesn't seem quite true, as `git request-pull` command exists since 2005.
> the entire concept of a pull request is foreign to git
which is incorrect, since the the concept already existed, but was simply
> designed for email workflows
Indeed, GitHub-specific pull-requests didn't exist before GitHub, but that's a tautology, isn't it?
- an easy way to reset but I just switch to the command line for that - it's the only cli command I have to know
- decent submodule support (at least, as of the last time I was on a project that used these awful things)
- decent cherry picking (which I've only had to use when on project with awful merges - like when using submodules...)
I use the command line for everything but resolving merge conflicts. I really like the JetBrains UX for resolving them!
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
Local has two options: "Checkout with the GitHub CLI" and "Checkout with GitHub Desktop."
Codespaces is an ad for buying codespaces for this repo (none exist).
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:
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.
> There is no "default workflow" for git
The default workflow, as in what Github promotes. Github's default, not git's. That's what's meant.
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.
Of course it's easier than what you described, but that's not something you ever needed to do in order to checkout a pull request's branch; all you need to do it to checkout `pull/<ID>/head` from the repo PR has been made against - and that's what `gh pr checkout` does too.
(there's also `pull/<ID>/merge`, which contains the PR's branch already merged into target branch)
This works with GitLab too BTW, but you have to replace `pull` with `merge-requests`.
https://github.com/cli/cli
git doesn't care who hosts your code
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.
Sure, the whole workflow isn't a "standard Git workflow" but they could easily provide a command that works with the standard Git CLI.
And that's what they used to do there.
Do all git mutations from command-line using `git`.
One useful tip is that you can go to github.com/<org-repo>/pull/<branch-name> rather than PR# and it will redirect.