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
.mddocs, images, etc.) - A hidden
.gitfolder 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)
| Step | What it Means | VS Code Action |
|---|---|---|
| 1. Make Changes | Edit files in the repo. | Just open .md files and type away. |
| 2. Stage Changes | Tell 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 Changes | Save 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 / Push | Upload 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
Type a short message in the “Message” box:
- ✅ Good:
Fix typo in introduction - ❌ Bad:
Stuff
- ✅ Good:
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
| Problem | Likely Fix |
|---|---|
| File disappeared or looks wrong | Open Source Control → Right-click → Discard Changes to undo edits since last commit. |
| Forgot to stage before commit | You can stage changes and commit again. Git stores every commit separately. |
| VS Code asks to “Pull” before pushing | Someone 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.