Git is a tool that remembers every version of your project. Think of it as an unlimited “undo” button that also lets many people work on the same code without stepping on each other.
The problem it solves
Before Git, people saved files like report_final.doc, then report_final_v2.doc, then report_final_REALLY_final.doc. We have all been there. Git ends this madness by keeping a proper history for you.
The main idea: commits
You work on your files, and when you reach a sensible point, you make a commit. A commit is a saved snapshot of your whole project at that moment, with a short message describing what changed.
git add .
git commit -m "Add login page"
Later you can look back at the history, see what changed and when, and even jump back to any old snapshot.
Why it is so powerful
- History: You never lose old work. Every commit is saved.
- Branches: You can try a risky idea in a separate copy without breaking the main code. More on that in Branches explained.
- Teamwork: Many people can work in parallel and merge their changes together.
Git is not GitHub
This confuses everyone at the start. Git is the tool on your computer. GitHub is a website where you store your Git projects online. I explain the difference properly in Git vs GitHub.
Where to start
Learn just four commands first: add, commit, push, and pull. That covers ninety percent of daily work. The scary stuff can wait. See Everyday Git commands.