Start.dev
Back to blog

Git for beginners: the 10 commands you'll use every day

Git has hundreds of commands, but you only need about ten. Learn the everyday Git commands for saving, reviewing, branching and sharing your work.

Ariel Weinberger
Ariel Weinberger · 5 min read

Git looks enormous from the outside. There are hundreds of commands, thousands of flags, and a lot of advice that starts with "well, it depends." The good news: day to day, you use about ten of them.

This post walks through those ten in the order you'll actually reach for them. Learn these and you can save your work, see what changed, work on ideas in isolation, and share it all with a team.

The mental model: three places

Before the commands, one idea makes everything else click. Git tracks your files in three places:

  • Working tree: the files on disk, as you're editing them.
  • Staging area: a waiting room where you choose what goes into the next save.
  • Repository: the permanent history of saves, called commits.

Most Git commands move changes from one of these places to the next. If you ever get confused, ask yourself: "which of the three places is this change in right now?"

Getting started: git init and git clone

Every project begins one of two ways. Start from scratch in a folder you already have:

git init

Or copy an existing project, history and all, from somewhere else:

git clone https://github.com/your-name/your-repo.git

You only run these once per project, which is why they're not on the daily list. Our lessons on Initializing A Repository (opens in a new tab) and Cloning A Repository (opens in a new tab) cover both in detail.

1. git status: where am I?

git status

This is the command you'll type most. It tells you which branch you're on, which files changed, and which of those changes are staged. When you're unsure about anything in Git, run git status first. It's free, it never changes anything, and it usually tells you the next step.

2. git add: choose what to save

git add index.html        # stage one file
git add .                 # stage everything that changed

git add moves changes into the staging area. Staging is what lets you make a clean, focused commit even when you've touched five unrelated files. See Staging Files (opens in a new tab) for the full picture.

3. git commit: save a snapshot

git commit -m "Add login form validation"

A commit is a snapshot of everything you staged, plus a message explaining why. Write messages for your future self: short, specific, and in the present tense. "Fix typo" is fine. "stuff" is not. Read more in Committing (opens in a new tab).

4. git diff: what exactly changed?

git diff            # changes you haven't staged yet
git diff --staged   # changes you're about to commit

Before every commit, take ten seconds to read your own diff. You'll catch leftover debug logs, accidental edits, and half-finished thoughts. Viewing Changes With Git Diff (opens in a new tab) shows how to read the output.

5. git log: what happened before?

git log --oneline

The --oneline flag squeezes each commit into a single line, which is far easier to scan than the default. Use it to find when something changed and to see how your history reads. Try it alongside Reading History (opens in a new tab).

6. git switch: work on branches

git switch -c add-search   # create a new branch and move to it
git switch main            # go back

A branch is an independent line of work. Try a risky idea on its own branch, and your main code stays safe. If the idea fails, delete the branch. If it works, merge it. The lesson on Creating And Switching Branches (opens in a new tab) is a good place to practice.

7. git merge: bring work together

git switch main
git merge add-search

Merging combines the history of one branch into another. Usually Git does it automatically. Sometimes two branches change the same lines, and you'll get a merge conflict. That sounds scary, but it just means Git is asking you to pick the right version. Merge Commits (opens in a new tab) and Resolving A Merge Conflict (opens in a new tab) walk through both cases.

8. git pull: get your teammates' changes

git pull

git pull downloads new commits from the remote repository and merges them into your current branch. Make it a habit to pull before you start work and before you push. You'll avoid most collisions that way. See Fetching And Pulling (opens in a new tab).

9. git push: share your work

git push origin add-search

Commits live only on your machine until you push them. git push uploads your commits to the remote, such as GitHub, so teammates can see them and you have a backup. The first push of a new branch is covered in Pushing Commits (opens in a new tab).

10. git restore: undo a mistake

git restore index.html            # throw away unsaved edits to a file
git restore --staged index.html   # unstage a file, keep your edits

Everyone breaks something eventually. git restore is the safe, everyday way to back out. One warning: restoring unsaved edits can't be undone, because those changes were never committed. Take a look at Discarding Working Tree Changes (opens in a new tab) and Unstaging Files (opens in a new tab) before you rely on it.

The daily loop

Put it together and a normal day looks like this:

git pull                       # start with the latest
git switch -c fix-navbar       # new branch for the task
# ...edit files...
git status                     # see what changed
git diff                       # review it
git add .                      # stage it
git commit -m "Fix navbar overflow on mobile"
git push origin fix-navbar     # share it

That's the whole rhythm. Everything else in Git builds on it.

Practice Git without the setup

Here's the catch with learning Git from a blog post: reading commands isn't the same as running them. Git only sticks when you've made a mess, read the output, and fixed it yourself.

That's why we built Git practice right into the browser. There's nothing to install and nothing to configure. Here's the Staging and Committing Files lesson in action:

The Start.dev Git course in the browser: typing git add and git commit in a terminal while the working tree, staging area and history panel updates live

The lesson sits on the left and a real terminal sits beside it. On the right, a live view shows the three places from earlier: working tree, staging area and history. Type git add and you watch the file move from one to the next. Type git commit and it lands in history. The mental model stops being a diagram and becomes something you can see change as you work.

Around that, you get a checklist of steps for each lesson, a helper you can ask questions, and a badge when you finish. And because it's all in the browser, the first time you hit a merge conflict you're in a safe place where nothing real is at stake.

We're proud of this one: no other learning platform offers an in-browser Git experience like it. It's the fastest way we know to go from "I've read about commit" to "I know what commit does."

Try it in Learn Git (opens in a new tab), where each of the commands above has its own hands-on lesson.

Wrap-up

You don't need to memorize all of Git. Learn status, add, commit, diff, log, switch, merge, pull, push and restore, and you can handle the vast majority of what real projects throw at you. The rest you can pick up when you need it. When you start shipping apps you built with AI help, our guide to vibe coding best practices covers what to check before you call them done.

Ready to practice? Start here:

Level up your coding skills

Jump into interactive courses and start building real-world projects.

Start learning

Related posts

AI made polished resumes and portfolio projects easier to produce. Learn how junior developers can replace weak signals with credible proof of skill.
Ariel Weinberger
Ariel Weinberger · 5 min read
Learn practical vibe coding best practices for reviewing AI-generated code, isolating user data, testing failure paths, and understanding what you ship.
Sulamita Ivanov
Sulamita Ivanov · 8 min read
Start.dev and Scrimba both teach web development hands-on. Here is how they differ in format, practice, AI help, and pacing, and which one fits the way you learn.
Ariel Weinberger
Ariel Weinberger · 6 min read