Git
A save-point tool for code and files. It lets you go back to older versions anytime and work with teammates without overwriting each other.
On this page
What is Git?
Git is a version control tool—basically a notebook that tracks every change to your files. Whenever you finish a small step, Git takes a “snapshot” of your project folder and writes down who changed what and when.
Think of save points in a video game: you save after each level, and if you mess up later, you reload an earlier save. Git saves your code and files instead of game progress.
Git is the save-point tool on your computer. GitHub is just a website that stores Git repositories online.
What does saving a version in Git look like?
Most of the time you use these four simple steps. They all happen on your own computer—even without internet.
Start tracking: run
git initinside your project folder to turn it into a “Git repository” (a folder with save-point superpowers).Pick what to save: use
git addto choose the changed files for this save point. Unfinished changes can wait for next time.Make the save point: run
git committo store those chosen changes as a snapshot, along with a short note, your name, and the time.Rewind or try ideas safely: later you can jump back to any old save, or open a “branch”—like copying your homework onto scratch paper to test an idea, then merging it back if it works.
A commit only saves on your own computer. You only need internet when you send saves online with git push or pull teammates’ updates.
See one real save point
Suppose you just wrote a homepage file named index.html and want to save your very first version.
git init: turns the current folder into a Git repository and creates a hidden.gitfolder to store all saves.git addandgit commit: pickindex.html, then save it as a snapshot with the noteAdd homepage.- After saving, you can run
git logto see every past save. Each one has a unique ID (like a package tracking number, called a “commit hash”).
These three commands create the repository, pick the file, and save the snapshot:
git init
git add index.html
git commit -m "Add homepage"The first version of index.html is now safely stored. Each time you edit and commit again, a new page is added to your project’s photo album.
How is Git different from copying folders?
Many people save backups as “essay-1”, “essay-final”, and “essay-really-final”. That manual trick is very different from Git.
| Compare | Using Git | Copying folders by hand |
|---|---|---|
| What gets saved | A neat timeline of every save, showing exactly which lines changed | Whole duplicate folders piling up, with no clue what changed inside |
| Going back to an older version | Pick any save point and jump right back | Dig through confusing folder names and hope you grab the right one |
| Working with teammates | Everyone works on their own branch, then Git helps merge the work | People overwrite each other’s files and lose changes |
Git pairs best with code-hosting websites like GitHub, GitLab, or Gitee: you commit on your computer, then push your repository online so teammates can see and pull it. Avoid syncing a Git folder directly inside a regular cloud drive (like Dropbox or OneDrive), because that can corrupt its save data.
When should you use Git?
Whenever a project will change over time—especially with more than one person—Git is worth using.
- Solo projects: undo mistakes anytime, and test wild ideas on a branch without breaking your working copy.
- Team projects: everyone builds on their own branch without stepping on toes, then merges into the main branch.
- Open-source projects: make your own copy of someone’s public project (called a fork), improve it, and ask the author to merge your changes.
Creating a branch takes almost zero space and finishes in a split second, and the full history shows exactly who changed what.
Git is great for text and code, not for huge videos, giant photos, or installers. Also, Git is not automatic cloud backup—if your computer breaks and you never pushed online, local saves are lost too.
Common things people get wrong
Are Git and GitHub the same thing?
No. Git is the save-point tool on your computer; GitHub is a website that stores Git repositories online (like a cloud album for code). You can also use GitLab, Gitea, or use Git offline on your own computer.
Does commit mean uploading online?
No. git commit only saves changes on your own computer. To send them online, you run another command: git push.
Does creating a branch copy the whole project and fill up my disk?
No. A Git branch is just a tiny movable bookmark (pointer) aimed at a save point—it does not copy all your files. Making branches is nearly instant, so feel free to use them.
Quick quiz
You messed up your code, but you already made a Git commit (save point) before editing. Can you get back to how it looked before?
Yes. Your earlier commit is still safely stored in the repository. You can switch back to inspect it, or restore your files to that exact state and make a fresh commit.
Remember this: Git does not store only the newest file—it keeps a whole chain of save points you can always return to.
Read further
These official guides are a great next step.