What are must-know git commands that you should know?

I created a GitHub repo called beginner-git-commands which is really an online notes page for myself. I’ve only pushed a project to an empty repo or cloned someone else’s repo. Are there any other basic commands that I should know? Would you create a repo at the same time as your initial push? Does anyone do that?

I also know most of the commands associated with branches, but I wanted to check if there is anything that I am missing.

Have you tried searching for this?
Was there something that came back that you didn’t understand?
Was there something that came back that you didn’t believe?

Have you searched for this?
This also gives back a few results. Is there something you didn’t understand?

I’m not trying to be rude but both questions are pretty broad and generate a good amount of results from a search so it’s hard to expand on what you want to know unless we know what you’re not understanding.

Have you tried searching for this?

Yes, for both. For the must-know, the articles I looked for pretty much had the same thing. And I know that a lot of blog writers copy articles on page 1 of the SERPS.

As for creating a repo from the command line, I found GitHub docs with the commands to do it. I got errors using :


Now I was doing it from VS Code, but maybe I should have used Git Bash.

No worries, I’ll assume what I have in my repo README has the majority of what I need.

gh is the name of GitHub’s CLI tool. Git can’t create repos on GitHub because git doesn’t know anything about GitHub. So to run gh commands, you would need to install GitHub’s tool, as it says at the start of that linked article.

Thanks, I missed that part. But in practice, is that a common practice - to create a repo from the command line?

take TheOdinProject curriculum. They taught it in the foundation, along with brew and command line. FCC is great with its curriculum, User Stories, TDD and so on. I took the certification up to this point, advanced node-js, but in this aspect TOP gives more attention.

if you use a GitHub’s CLI tool it lets you create the remote on GitHub at the same time as initialising a local repo, so if you use GH’s CLI tool then yeah I guess so, sometimes, it might be convenient if you remember it exists. I normally want to make sure I’ve set things up correctly in a project before I push anything, I’m not sure it’s terribly useful.

Anyway git doesn’t care what service you’re using as the remote source of truth, it makes no difference if you’re using GitHub or GitLab or whatever. And GitHub credentials are needed to use GitHub, the CLI tool is just a command-line helper that you can use instead of clicking around on their web app.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.