Skip to main content

Git Cheat Sheet for Total Beginners (VS Code Edition)

1️⃣ What is a Repository?

A repository (or “repo”) is just a folder that contains:

  • Your project files (like .md docs, images, etc.)
  • A hidden .git folder that tracks changes over time

Think of Git like a time machine for your folder — it remembers every change you save.


2️⃣ The Core Git Workflow (Your 4 Steps)

StepWhat it MeansVS Code Action
1. Make ChangesEdit files in the repo.Just open .md files and type away.
2. Stage ChangesTell Git: “I want to include these edits in my next snapshot.”In the Source Control panel (left toolbar icon), click the + next to each file you want to include.
3. Commit ChangesSave a permanent snapshot of the staged changes with a short description.Type a short message (“Updated About page”) in the message box, then click ✓ Commit.
4. Sync / PushUpload your commits to the shared repo so others see them.Click the ⭱ Sync Changes button (bottom left).

3️⃣ VS Code Git Interface Basics

Open the Source Control Panel

  • Click the branch icon (looks like a fork) in the left activity bar.

  • This shows:

    • Changes — files you edited but haven’t staged yet
    • Staged Changes — files ready to commit

Stage a Change

  • Click the + next to a file in Changes.
  • Or click + at the top of the list to stage all changes at once.

Commit

  1. Type a short message in the “Message” box:

    • ✅ Good: Fix typo in introduction
    • ❌ Bad: Stuff
  2. Click ✓ Commit at the top.


Sync Changes

  • Push & Pull in one click:

    • Click the ⭱ Sync Changes icon (bottom left corner of VS Code).
    • This uploads your changes and also fetches any changes others made.

4️⃣ Common “Oh No!” Moments

ProblemLikely Fix
File disappeared or looks wrongOpen Source Control → Right-click → Discard Changes to undo edits since last commit.
Forgot to stage before commitYou can stage changes and commit again. Git stores every commit separately.
VS Code asks to “Pull” before pushingSomeone else updated the repo — click Pull first, fix any merge conflicts, then Push again.

5️⃣ Quick Visual

[Edit File] → [Stage +] → [Commit ✓] → [Sync ⭱]

6️⃣ Golden Rules

  • Commit often — small changes are easier to manage.
  • Write clear messages — so future-you (and teammates) know what happened.
  • Always sync before starting work — get the latest version.