You're still emailing yourself zip files? Naming files like "final_v2_REAL_final.txt"? Stop. Git exists. Use it. You will lose code otherwise. It's not a matter of if, it's a matter of when.
What Git Actually Does
Git tracks changes to your files. Every time you commit, you're saving a snapshot of your project at that moment. You can go back to any snapshot. You can create branches to experiment without destroying your working code. You can merge changes back together.
Linus Torvalds created Git in 2005 because the existing version control systems all sucked. He needed something to manage the Linux kernel - the biggest open source project on the planet. Git handles it. It can handle your shit too.
The Only Commands You Need
Forget the 47 Git tutorials you've bookmarked. Here's the basics:
# Initialize a new repository
git init
# Check what's changed
git status
# Stage changes (prepare them for commit)
git add filename.py
git add . # Stage ALL changes
# Commit (save the snapshot)
git commit -m "Describe what you changed"
# See history
git log
# Go back to a previous commit
git checkout commit-hash
# Create a new branch
git branch experiment-name
# Switch to a branch
git checkout experiment-name
# Merge a branch
git merge experiment-name
How It All Fits Together
Think of it like this:
- Repository (repo) - The entire project, including its history
- Commit - A saved snapshot with a message explaining what changed
- Branch - A parallel version of your code
- Merge - Combining branches back together
- HEAD - Your current position (which commit you're on)
The main branch is usually called "main" or "master". Don't touch main directly. Create a branch, work on it, test it, then merge.
The Workflow That Works
Here's the minimum viable workflow:
1. git init # Start tracking a project
2. git add . # Stage all your changes
3. git commit -m "msg" # Save a snapshot
4. Repeat 2-3 as you work
# When you break something:
5. git log # See your commits
6. git checkout hash # Go back to when it worked
That's it. That's the entire workflow for solo development.
When You Need More
Eventually you'll need these:
git diff- See exactly what changed between commitsgit stash- Temporarily save changes without committinggit reset --hard- Blow away uncommitted changes (careful!).gitignore- Files you don't want Git to track
GitHub Is Not Git
Stop confusing these. Git is the version control system. GitHub is a hosting service for Git repositories. You can use Git without GitHub. You can use GitHub without using their (creepy) AI features.
Self-host your Git repos if you care about privacy. Gitea is excellent. GitLab is fine. Or just use Git over SSH on your own server. The choice is yours. That's the point.
Start Now
Every project, no matter how small, should be in Git. Right now. Go initialize a repo. Make your first commit. It's not that hard.
Learn more:
- Our Git Guide - Interactive lessons
- Git Hangman - Test your knowledge
- Official Git Documentation - Read it