Git

What it is

Git is a distributed version control system (DVCS) and the de-facto source-control engine behind every major DevOps platform. Every developer has a full copy of the repository (the working tree plus the entire history), so they can commit, branch, and merge locally without a server.

Why it exists

Teams need to track every change to code, collaborate in parallel without overwriting each other, and roll back any point in history. Centralized VCS required a network round-trip for every operation; Git’s distributed model makes version control fast, resilient, and branch-friendly, which is what enables the pull-request workflow.

Key ideas

  • Commit — a snapshot of changes with a message; Git stores the whole project state, keyed by a SHA-1 hash of its contents.
  • Branch — a movable pointer to a commit, letting work proceed in parallel.
  • Repository (repo) — the .git folder holding all objects, refs, and configuration.
  • Remote — a shared copy (origin) that developers push to and fetch/pull from.
  • Working directory / staging area / HEAD — Git’s three-part model: edit, git add to stage, git commit to record.
  • Three states — modified, staged, committed.

Common workflow (memorize)

git clonegit checkout -b feature → edit → git addgit commitgit push → open a pull-request → merge to main.

Exam notes

  • Git is distributed, not centralized — every clone is a full backup.
  • A commit is content-addressed by its hash; history is a chain of commits.
  • git pull = fetch + merge (or --rebase).
  • Azure DevOps and GitHub both host Git repos; they share the same Git engine with different collaboration tooling on top.

branching-strategy · pull-request · merge-conflict · git-hooks · azure-repos · github

📘 Source: Microsoft Learn — Git