Git Command Reference

Git is the version control system used by every professional developer. Track changes, collaborate with others, and never lose work again. Choose your level below.

Learning mode:

What is Git?

Git is a version control system. It tracks every change you make to your code files — who changed what, when, and why. If you break something, you can roll back. If you want to try something risky, you can branch off, experiment, and merge back if it works.

Git runs locally on your computer. GitHub is a website that hosts your Git repositories online so you can share them and collaborate with others.

Installing Git: Download from git-scm.com. After installing, open Terminal (Mac/Linux) or Git Bash (Windows) and type git --version to confirm it's working.

First-Time Setup

Before your first commit, tell Git who you are. This name and email will appear in your commit history.

Shell — Git Setup
git config --global user.name "Your Name" git config --global user.email "you@example.com" git config --global core.editor "code --wait"

Starting a Repository

git init
Creates a new Git repository in the current folder. Run this once when starting a new project.
git clone <url>
Downloads an existing repository from GitHub (or any remote) to your computer.
Shell — Starting a project
mkdir my-project && cd my-project git init git clone https://github.com/username/repo-name.git

The Daily Workflow

Every day you'll use these four commands. They form the core loop of working with Git: check what changed, stage it, commit it, push it.

git status
Shows which files have changed, which are staged, and which are untracked. Run this constantly.
git add <file>
Stages a specific file for the next commit. Use git add . to stage everything.
git commit -m "message"
Saves staged changes as a snapshot with a description. Write clear, present-tense messages.
git push
Uploads your local commits to the remote repository (GitHub). Others can then see your changes.
git pull
Downloads and applies the latest changes from the remote. Always pull before starting new work.
git log
Shows the commit history — who committed what and when. Press Q to exit.
Shell — Daily workflow
git pull git status git add index.html styles.css git commit -m "Add hero section and fix nav styles" git push

Ignoring Files

Create a file called .gitignore in your project root. List files and folders you never want to commit — like node_modules/, .env files, or OS files like .DS_Store.

.gitignore — Common entries
node_modules/ .env .env.local .DS_Store dist/ *.log
Next step: Try Intermediate mode to learn about branching — how to work on features without breaking your main code.