What version control does and why you need it
Version control is a system that tracks every change you make to your files — who changed what, when they changed it, and why. Instead of ending up with dozens of files named "final_report.docx", "final_report_v2.docx", and "final_report_ACTUAL_FINAL.docx", version control keeps one file and remembers every version of it. You can see what changed between any two points in time, undo a mistake from three weeks ago without losing the work you did since, and work on the same files as other people without overwriting each other's changes.
Version control is essential if you write code, but it also works for documents, spreadsheets, design files, and anything else you edit over time. It solves the core problem of file storage: files change, and you need to know what changed and be able to go back.
Key Takeaways
- Version control tracks every change to your files and lets you see exactly what changed, when, and by whom.
- A repository is the folder where version control stores your files and their complete history.
- Git is the most common version control system; GitHub, GitLab, and Bitbucket are services that host repositories online.
- Local repositories live on your computer; remote repositories live on a server and let multiple people work on the same files.
- You do not need to choose between version control and cloud storage — they work together, and many people use both.
Repositories: where your version history lives
A repository (or "repo") is a folder that contains your files plus a hidden subfolder where version control stores the complete history of every change. When you create a repository, you are not creating a new kind of file — you are telling version control software to start watching that folder and recording changes.
A local repository lives on your computer's hard drive. You edit files normally, and version control runs in the background. When you are ready to save a version (called a "commit"), you tell version control which files changed and add a message explaining why — "Fixed the login bug" or "Added customer feedback section". Version control then records that snapshot of your files.
A remote repository is the same thing, but stored on a server instead of your computer. Remote repositories let multiple people work on the same files. When you push your changes to the remote, other people can pull them down. If two people edit the same file, version control can usually merge the changes automatically. If they edited the same line, it flags the conflict and asks you to decide which version to keep.
Git and the services that host it
Git is the version control software itself — the program that tracks changes and manages repositories. It runs on your computer and does the actual work of recording versions, comparing files, and merging changes. Git is free, open-source, and the industry standard for code.
GitHub, GitLab, and Bitbucket are services that host Git repositories on their servers. They provide the remote repository, a web interface where you can view your files and history, tools for reviewing changes before they are merged, and features like issue tracking and project management. GitHub is the largest and most widely used; GitLab and Bitbucket offer similar features with different pricing and privacy options.
You do not have to use a hosting service to use Git — you can keep repositories only on your computer. But a remote repository on GitHub or GitLab gives you a backup, lets other people collaborate, and makes it straightforward to access your work from any computer.
How version control fits with cloud storage
Version control and cloud storage (like Google Drive, Dropbox, or OneDrive) solve different problems. Cloud storage syncs your files across devices and backs them up. Version control tracks changes and lets you revert to old versions. You can use both at the same time.
Many people keep their repositories in a cloud storage folder so they get both benefits: version control's change tracking and cloud storage's automatic backup and device sync. This works, but it can cause problems if two devices try to sync the same repository at the same time. A safer approach is to keep your local repository on your computer's main drive and use the hosting service (GitHub, GitLab, or Bitbucket) as your remote backup instead of a cloud storage folder.
If you are working with documents or spreadsheets that multiple people edit at the same time, cloud storage's real-time collaboration (Google Docs, Office 365) is usually better than version control. Version control is designed for files that one person edits at a time and then commits a finished change.
Getting started with Git and a repository
To start using version control, you install Git on your computer (read it from git-scm.com for free). Then you create a repository in any folder by running a command. Git creates a hidden .git folder that stores the history.
As you work, you edit files normally. When you finish a piece of work, you tell Git which files changed and commit them with a message. Git records that snapshot. You can see the full history, compare any two versions, and revert to an old version if you need to.
If you want to back up your repository online or collaborate with others, you create an account on GitHub, GitLab, or Bitbucket, create a repository there, and push your local repository to it. Now your files and their complete history live in two places: your computer and the server. Other people can clone the repository (read a copy) and start working on it.
When version control matters most
Version control is essential for code because code changes constantly, multiple people edit the same files, and a single mistake can break everything. Being able to see exactly what changed and revert it in seconds is not a convenience — it is necessary.
Version control is also useful for documents, spreadsheets, and design files if you edit them over time and want to keep a history. It is less useful for files you create once and rarely change, or for files that many people edit at the exact same time (where cloud storage's real-time collaboration works better).
If you work alone on a project that changes slowly, version control might feel like overkill. But the cost of setting it up is low, and the benefit of having a complete history and a backup is real. Many people find that once they start using version control, they use it for almost everything.
Frequently Asked Questions
Do I need to use GitHub if I use Git?
No. Git works entirely on your computer without any online service. GitHub, GitLab, and Bitbucket are optional — they provide a remote backup and make collaboration easier, but you can use Git locally only. Most people use a hosting service because the backup and collaboration features are worth it.
What happens if two people edit the same file at the same time?
Git can usually merge changes automatically if you edited different parts of the file. If you both edited the same line, Git flags it as a conflict and asks you to decide which version to keep. You resolve the conflict, commit the merged version, and move on. This is one of version control's main strengths.
Can I use version control for Microsoft Word documents or PDFs?
Technically yes, but it does not work well. Version control is designed for plain text files (code, markdown, CSV). Word documents and PDFs are binary files, so version control cannot show you what changed inside them — it just knows the whole file is different. For documents, cloud storage with version history (Google Drive, OneDrive) usually works better.
If I push my repository to GitHub, is my code public?
By default, repositories on GitHub are public — anyone can see them. You can make a repository private so only people you invite can see it. Private repositories are free on GitHub if you have a personal account, though there are limits on how many collaborators you can have.
What is the difference between Git and GitHub?
Git is the software that runs on your computer and tracks changes. GitHub is a website where you can store your Git repositories online. Git is the tool; GitHub is the service. You can use Git without GitHub, but you cannot use GitHub without Git.
