Welcome to Git: Your Code Time-Machine! 🚀
If you have ever made copies of a document named project_final.txt, project_final_v2.txt, and project_final_REAL_final.txt, then you already understand why we need Git!
Git is a tool that tracks the history of your files automatically. It works like a video game save-system and a time-machine all in one, allowing you to work safely without the fear of breaking your code.
The Core Concepts in Plain English
- Commit (A "Save Point"): A snapshot of your project at a specific moment. If you make a mistake later, you can always jump back to this exact save point.
- Branch (An "Alternate Timeline"): A safe sandbox where you can try out wild new ideas or fix bugs without messing up your main, working code.
- Remote (The "Cloud"): A copy of your project stored on the internet (usually on GitHub) so you can share it with teammates or access it from another computer.
Quick Reference Cheat Sheet
Here is how to handle the most common everyday tasks:
| What you want to do | The Command | What it actually does in plain English |
|---|---|---|
| Start a new feature safely | git checkout -b <branch-name> |
Creates a brand-new timeline and jumps inside it. |
| Grab just one fix from elsewhere | git cherry-pick <save-point-ID> |
Copies a single specific save point from another timeline and pastes it onto yours. |
| Erase a mistake you just made | git reset HEAD~1 |
Time Travel: Wipes away your last save point completely (use only if you haven't shared it yet!). |
| Undo a mistake you already shared | git revert HEAD |
The Safety Net: Creates a new save point that undoes your previous mistake, keeping your history intact. |
| Get updates from the team | git pull |
Downloads the newest changes from the cloud and blends them directly into your current files. |
Game Level Companion Map
This handbook is structured to follow the exact learning path of the Learn Git Branching interactive game. Use this map to quickly find the answers for each level:
🏠 Local Levels (Main Phase)
- Introduction Sequence (Commits, Branching, Merging, Rebasing) $\rightarrow$ Look at Branches
- Ramping Up (Detached HEAD, Relative Refs
^/~, Reset & Revert) $\rightarrow$ Look at Branches - Moving Work Around (Cherry-pick, Interactive Rebase
-i) $\rightarrow$ Look at Juggling - A One-Man Show & Advanced Lessons (Commit Juggling, Tags, Git Describe) $\rightarrow$ Look at Juggling and Milestones
☁️ Remote Levels (Remote Phase)
- Push & Pull Pack (Cloning, Fetching, Pulling, Divergent History) $\rightarrow$ Look at Remotes
- To Origin and Beyond (Tracking Properties, Explicit Targets, Colon
:Arguments) $\rightarrow$ Look at Pro Tricks
Deepen Your Learning
Ready to explore further? Use these internal guides and external practice fields to master Git:
Internal Guides
- Explore GitHub Cloud Basics — Learn how to create repositories online, fork projects, and open pull requests.
- Understand Git Zones — Learn how files move from your computer folder to the staging area and your local database.
- Master Branching & Timelines — Dive deeper into merging, rebasing, and shifting your pointers.
Recommended Interactive Resources
- Learn Git Branching Game — An excellent, visual game that lets you practice moving commits, branches, and remotes directly in your browser.
- Official GitHub Docs — The official, comprehensive manuals and tutorials provided directly by GitHub.