Git & version control
Overview
Git is a distributed version control system: every clone has full history, branches are cheap, and merges/rebases integrate parallel work. GitHub/GitLab/Bitbucket add collaboration (PRs, issues, CI hooks) on top of Git’s object model.
Key concepts
- Repository & commits — Snapshots addressed by SHA-1/SHA-256 hashes.
- Branches & HEAD — Movable pointers to commit lines; default often
main. - Merge vs rebase — Combine histories vs replay commits for linear history.
- Remote tracking —
origin/mainvs localmain. - Hooks — Client/server scripts for linting and policy checks.
Feature branch workflow
Sample: everyday commands
git checkout -b feat/login-validation
# edit files
git add -p
git commit -m "Validate email on login form"
git push -u origin feat/login-validation