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.
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
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.
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 thangh repo clone
(gh repo clone OWNER/REPO
)- using
gh repo clone
to clone a fork and automatically add the GitHub upstream repository
© 2022 - 2024 — McMap. All rights reserved.