What is the difference between git and Github CLI or gh?
Asked Answered
Z

3

28

What is the difference between git and GitHub CLI? Which one should I use, git or GitHub CLI or gh depending on the situation? For example, cloning a repository, both commands support it. What gives? I am specifically asking for the GitHub CLI not GitHub itself.

Zircon answered 10/11, 2020 at 5:10 Comment(1)
Does this answer your question? Difference between Git and GitHubPortie
B
24

git is used for git in general you can use Bitbucket or GitLab any provider with it you just add remote and you can push.

But Github CLI is for Github you can manage many features of Github from CLI e.g issues.

I personally prefer git as I am more comfortable and in many offices I don't use Github. https://git-scm.com/docs/git-remote.html#_examples

Basifixed answered 10/11, 2020 at 5:17 Comment(1)
Thanks, I was confused.Zircon
S
5

Another difference, since Sept. 2021, is its extensibility.

Creating GitHub CLI extensions

GitHub CLI extensions are custom GitHub CLI commands that anyone can create and use. For more information about how to use GitHub CLI extensions, see "Using GitHub CLI extensions"

You need a repository for each extension that you create. The repository name must start with gh-. The rest of the repository name is the name of the extension. At the root of the repository, there must be an executable file with the same name as the repository. This file will be executed when the extension is invoked.

While you can create aliases with git commands, you now can create complexe commands with gh extensions.

Superfluity answered 3/9, 2021 at 21:3 Comment(0)
Z
5

As said before that gh is for GitHub, literally the description says:

Work seamlessly with GitHub from the command line.

Regarding about the similar commands of cloning a repositoy (I feel like I remember what I was asking):

  • git clone has more limited syntax than gh repo clone (gh repo clone OWNER/REPO)
  • using gh repo clone to clone a fork and automatically add the GitHub upstream repository
Zircon answered 2/11, 2021 at 23:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.