Git BEGINNER’S MANUAL
Source: Dev.to

If you’re just starting out with coding or working on projects with others, you’ve probably heard about Git.
Git is a tool that helps you keep track of your code, see what changes were made, and work with others without accidentally messing things up. Think of it like a magical notebook that remembers every change you make and lets you go back in time whenever you need.
This guide will walk you through the basics: tracking changes, pushing and pulling code, and understanding version control—all in plain English.
What is Version Control, Anyway?
Before Git, managing code changes was messy. If two people edited the same file, it could be a nightmare to combine their work. That’s where version control comes in.
Version control systems (like Git) keep a history of your project. You can:
- See exactly what changed and when.
- Revert back if something breaks.
- Collaborate with others safely.
Basically, Git keeps your code organized and your sanity intact.
Git Basics: Key Terms You Should Know
- Repository (repo) – Your project folder tracked by Git. You can have one on your computer (local) or on GitHub (remote).
- Commit – A snapshot of your code at a particular moment. Think of it like saving your game progress.
- Branch – A parallel version of your project. You can experiment on a branch without affecting the main project.
- Push – Send your local changes to the online repository.
- Pull – Grab the latest changes from the online repository to your computer.
Step 1: Setting Up Git
Install Git
Download it from and follow the instructions for your computer.
Set your name and email
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
This tells Git who made which changes.
Step 2: Starting a Git Repository
cd path/to/your/project
git init
This creates a hidden folder where Git keeps track of everything you do.
Step 3: Tracking Your Changes
Git keeps an eye on your files, but you have to tell it when you want to save a snapshot.
Check what’s changed
git status
Stage files – Choose which files you want to save
git add filename
Or stage all files at once:
git add .
Commit changes – Save a snapshot
git commit -m "A short description of what you changed"
Think of staging as packing your bag and commit as taking a photo before sending it off.
Step 4: Working With a Remote Repository
If you’re collaborating, you’ll probably use a platform like GitHub.
Connect your local repo to GitHub
git remote add origin https://github.com/username/repo.git
Push your changes – Send your local commits to GitHub
git push origin main
Pull changes – Get the latest updates from GitHub
git pull origin main
Always pull before pushing so you don’t overwrite someone else’s work.
Step 5: Viewing History and Differences
See all commits
git log
See what changed in a file
git diff filename
This is like checking your project’s “time machine” to see what was done and when.
Step 6: Branching (Optional, But Handy)
Branches let you try new ideas without messing up the main project.
Create a branch
git branch new-feature
Switch to that branch
git checkout new-feature
Merge back to main when ready
git checkout main
git merge new-feature
Branches are like experimenting in a sandbox—you can play around safely!
Tips for Beginners
- Commit often – Small changes are easier to manage.
- Write meaningful commit messages – It helps you (and your teammates) understand your changes.
- Pull before pushing – Avoid conflicts!
- Use branches to try new things without breaking the main project.
Conclusion
Git might seem intimidating at first, but once you get the hang of it, it’s a lifesaver for developers. It helps you track your code, collaborate safely, and fix mistakes without panic.
Start small: make commits, push and pull, and explore branches. Soon, using Git will feel natural. Happy coding! 🚀
