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).

TermMeaning
Repository (repo)The project folder plus its full history (.git directory)
CommitA snapshot of the project with author, message and parent commit(s)
BranchA movable pointer to a commit
HEADPointer to what you have checked out (usually a branch)
Working tree / staging area (index) / repositoryEdited files → git add → git commit
RemoteAnother copy of the repo, usually origin
Pull request (PR) / merge requestA 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
YearMilestone
2005Linus Torvalds creates Git for Linux kernel development
2008GitHub launches
2014Git 2.0 — push.default=simple
2018Microsoft acquires GitHub; Azure Repos (Azure DevOps) supports Git
2019Git 2.23 — git switch and git restore split the many jobs of checkout
2020GitHub and Git default branch name moves to main (configurable via init.defaultBranch)
2020+git sparse-checkout, partial clone, git maintenance for big repos
2023Git 2.42+ — SHA-256 repositories maturing
2025Git 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:

  1. git switch main && git pull — start from the latest main.
  2. git switch -c feature/ORD-123-order-search — create a branch.
  3. Edit, git add -p, git commit -m "Add order search endpoint" — small, focused commits.
  4. git push -u origin feature/ORD-123-order-search.
  5. Open a pull request; CI runs build + tests; reviewers comment; you push fixes.
  6. Update with main if needed (git pull --rebase origin main or merge main in).
  7. Merge (merge commit, squash or rebase-merge per team policy); delete the branch.
  8. 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, .gitignore templates, Git LFS for big binaries.