What is Git?
Version control, history, and why every dev uses it
Skills taught: git.concepts, git.version-control
The problem Git solves
Imagine you're building a website. It works perfectly. You start adding a new feature. Three hours later — it's broken, and you can't remember what you changed. Without Git, you're stuck. With Git, you run one command and you're instantly back to the working version.
Core concepts
- Repository (repo)
- A folder that Git is tracking. Contains your files + a hidden .git folder with the entire history.
- Commit
- A snapshot of your files at a point in time. Every commit has a unique ID (hash), a message, an author, and a timestamp.
- Branch
- A parallel line of development. The default branch is called main (or master in older repos). Branches let you work on features without affecting the main codebase.
- Remote
- A copy of the repository stored elsewhere (e.g. on GitHub). You push your commits to share them, and pull others' commits to receive them.
Git vs GitHub
Git and GitHub are different things. Git is the tool — it runs on your machine and tracks history. GitHub is a website that hosts Git repositories in the cloud so teams can collaborate. Think of Git as the engine and GitHub as the parking garage.
Tip: Other hosting services exist — GitLab, Bitbucket, Gitea — but GitHub is the most popular and where most open-source code lives.
What a Git history looks like
$ git log --oneline
a3f2c1d (HEAD -> main) Add dark mode toggle
8b9e4f2 Fix login button on mobile
2c1a5e8 Add user profile page
d7f3b91 Initial commit — basic HTML structure
Each line is a commit. The leftmost 7 characters are the start of the commit's unique ID. You can go back to any of these with one command.
Frequently Asked Questions
Do I need to know the command line to use Git?
Basic Git requires a few terminal commands (git add, git commit, git push). Visual tools like GitHub Desktop, VS Code's built-in Git, and GitKraken exist — but learning the commands gives you a deeper understanding and works everywhere.
Is Git only for code?
Git works for any text files — code, markdown docs, config files, writing. It's less suited for binary files (images, videos, compiled binaries) since it can't show diffs meaningfully.