Roadmap › 3. Cloud & DevOps › Step 34
Git
Git & GitHub — Version Control from Basics to Advanced
How Git stores history, the daily commands, branching and merging, rebase, resolving conflicts, remotes and pull requests, branching strategies (GitFlow, trunk-based), undoing mistakes, tags and releases, hooks and the Git questions asked in every developer interview.
What it is & where it is used
Git is a distributed version control system: every developer has the full history locally, commits offline, and synchronises with a shared remote (GitHub, Azure Repos, GitLab, Bitbucket).
| Term | Meaning |
|---|---|
| Repository (repo) | The project folder plus its full history (.git directory) |
| Commit | A snapshot of the project with author, message and parent commit(s) |
| Branch | A movable pointer to a commit |
| HEAD | Pointer to what you have checked out (usually a branch) |
| Working tree / staging area (index) / repository | Edited files → git add → git commit |
| Remote | Another copy of the repo, usually origin |
| Pull request (PR) / merge request | A request to merge a branch, with review and CI checks |
Git vs older tools: TFVC and SVN are centralised (one server holds history, you check out files); Git is distributed, branching is cheap and merging is fast.
Versions & history
| Year | Milestone |
|---|---|
| 2005 | Linus Torvalds creates Git for Linux kernel development |
| 2008 | GitHub launches |
| 2014 | Git 2.0 — push.default=simple |
| 2018 | Microsoft acquires GitHub; Azure Repos (Azure DevOps) supports Git |
| 2019 | Git 2.23 — git switch and git restore split the many jobs of checkout |
| 2020 | GitHub and Git default branch name moves to main (configurable via init.defaultBranch) |
| 2020+ | git sparse-checkout, partial clone, git maintenance for big repos |
| 2023 | Git 2.42+ — SHA-256 repositories maturing |
| 2025 | Git 2.5x series; Git 3.0 planned (SHA-256 default, main default) |
Lifecycle
File states: untracked → (git add) → staged → (git commit) → committed → (edit) → modified → staged again …
Typical feature workflow:
git switch main && git pull— start from the latest main.git switch -c feature/ORD-123-order-search— create a branch.- Edit,
git add -p,git commit -m "Add order search endpoint"— small, focused commits. git push -u origin feature/ORD-123-order-search.- Open a pull request; CI runs build + tests; reviewers comment; you push fixes.
- Update with main if needed (
git pull --rebase origin mainor merge main in). - Merge (merge commit, squash or rebase-merge per team policy); delete the branch.
- Release: tag (
v2.3.0) and deploy through CD.
Tools used to develop
- CLI:
git(Git for Windows includes Git Bash and Git Credential Manager). - IDEs: Visual Studio Git window, VS Code Source Control + GitLens, JetBrains Rider.
- GUIs: GitHub Desktop, Sourcetree, GitKraken, Fork, TortoiseGit.
- Hosting: GitHub (PRs, Actions, Codespaces), Azure Repos (PRs, branch policies), GitLab, Bitbucket.
- Quality: pre-commit hooks, Husky (JS), commitlint,
.gitattributes,.gitignoretemplates, Git LFS for big binaries.