Most Git advice is scattered across docs and blog posts. This guide is not. It focuses on the five commands you will use every day and gives you the context that makes them predictable, not magical.
Before we start, keep this mental model in mind:
- Working tree: files on your disk right now.
- Staging area (index): the snapshot you are building for the next commit.
- Repository (HEAD): the last committed snapshot.
- Remote: the shared copy (usually
origin).
When Git feels confusing, it is usually because you have lost track of which layer you are looking at.
Here is the everyday loop in one line:
- See what changed (
git status) - Choose what to save (
git add) - Save a snapshot (
git commit) - Bring in team updates (
git pull) - Share your work (
git push)
1) git status
What it does: Shows the state of your working tree and staging area.
Why it matters: It is the fastest way to answer, "What did I change and what will be committed?"
Daily usage:
git status -sb
-sgives a compact summary-bshows the current branch
Example output (read it line by line):
## feature/login
M src/components/LoginForm.tsx
A src/utils/validate.ts
?? notes/todo.md
Mmeans modified but not stagedAmeans staged and ready to commit??means untracked
Useful variants:
git status -ushows untracked filesgit status -unohides untracked files (useful in large repos)
Pro tip: Run git status before and after every commit. It will prevent
90% of mistakes.
2) git add
What it does: Moves changes from the working tree into the staging area.
Why it matters: It lets you decide what goes into the next commit.
Daily usage:
git add .
Better for real work:
git add -p
-p (patch mode) lets you review and stage changes chunk by chunk. This is the
single best habit for clean commits.
Common patterns:
- Stage everything:
git add -A - Stage one file:
git add src/app.ts - Stage interactively:
git add -p
Undo a bad add:
git restore --staged <file>
Pro tip: Pair git add -p with git diff --staged to review exactly what
will be committed.
3) git commit
What it does: Creates a permanent snapshot from the staging area.
Why it matters: Commits are the building blocks of your history. Good commits are small, clear, and reversible.
Daily usage:
git commit -m "Add client-side validation"
Common variants (know what they do):
git commit -am "Message"stages and commits tracked files only (skips new files)git commit --amendupdates the last commit (do not use if already pushed)
Commit message rule of thumb:
- Start with a verb: Add, Fix, Update, Remove, Refactor
- Describe the change, not the file
Pro tip: If a commit feels too big to explain in one line, it is probably too big to be one commit.
4) git pull
What it does: Fetches from the remote and merges into your current branch.
Why it matters: It keeps your local branch in sync with your team.
Daily usage:
git pull
Know this: git pull = git fetch + git merge. If you prefer a linear
history, your team might use rebase instead:
git pull --rebase
When conflicts happen:
- Open the conflicted file
- Choose which changes to keep
- Run
git add <file> - Continue with
git commit(orgit rebase --continueif you rebased)
Pro tip: If you are unsure, run git fetch first and inspect with
git log --oneline --graph --decorate before merging.
5) git push
What it does: Sends your local commits to the remote.
Why it matters: It is how your work becomes visible to everyone else.
Daily usage:
git push
First push of a new branch:
git push -u origin feature/login
-u sets the upstream so future git push and git pull just work.
If you see "non-fast-forward":
- Pull first:
git pull --rebase - Then push again
Force push only when you must:
git push --force-with-lease
This is safer than --force, but still use it carefully.
Daily workflow example (realistic)
# Start the day
git status -sb
git pull --rebase
# Work on a feature
git add -p
git diff --staged
git commit -m "Add input validation for email"
git push
Quick cheat sheet
| Goal | Command | Example | Notes |
|---|---|---|---|
| See changes | git status | git status -sb | Shows branch + staged/unstaged summary |
| Stage files | git add | git add -p | Stage changes in small chunks |
| Save snapshot | git commit | git commit -m "Fix typo" | Commits staged changes only |
| Get updates | git pull | git pull --rebase | Fetch + merge (or rebase) |
| Share work | git push | git push -u origin feature/x | Set upstream on first push |
Common mistakes (and fixes)
- Committing everything blindly. Fix: use
git add -pand review withgit diff --staged. - Forgetting to pull before starting. Fix: make
git pull --rebasethe first command of the day. - Pushing a messy commit. Fix: use
git commit --amendbefore you push. - Working on
main. Fix: create a branch withgit checkout -b feature/x.
Bonus: three commands that level you up fast
git diff --stagedto review what you are about to commitgit log --oneline --graph --decorateto see history clearlygit restore --staged <file>to unstage mistakes without losing work
Next steps
If the five commands above feel easy, the next skills to learn are branching, rebasing, and stashing. But you do not need any of that to be effective today. Master these five and Git becomes predictable.
Ready to turn daily Git work into visible progress? Join GitRank to track your momentum, compare with peers, and keep your streaks honest.