Git Basics Every Developer Should Know
What is Version Control?
Version control is a system that records changes to files over time so you can recall specific versions later. Git is the most widely used distributed version control system — it tracks changes, enables collaboration, and never loses history.
Repositories
A repository (repo) is a folder that Git is tracking. Every repo contains a hidden .git directory that stores the full commit history. You can create a new repo with git init or download an existing one with git clone.
Commits
A commit is a snapshot of your project at a specific point in time. Each commit has:
- A unique hash (e.g.,
1a2b3c4) - A commit message describing the change
- Author name and timestamp
- A pointer to the parent commit
Make your first commit:
git add . git commit -m "Initial commit"
Branches
A branch is a movable pointer to a commit. By default you start on main (or master). Create branches to work on features or fixes in isolation:
git branch feature-login git checkout feature-login # or in one command: git checkout -b feature-login
Remotes
A remote is a copy of your repository hosted on a server (GitHub, GitLab, etc.). The default remote after cloning is called origin.
git push origin main git pull origin main
Next Steps
Practice these commands daily. Start with git init, make some commits, create branches, and push to GitHub. The more you use Git, the more intuitive it becomes.
Get the Offline Git Field Guide
The 97-page PDF + ePub course — $9. Read this command, offline.