Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Git — Complete Reference for Placement Preparation

Git is the de facto version control system in software engineering. Understanding Git deeply — from its internal data model to advanced workflows — is essential for technical interviews and real-world engineering.

Why Git Matters

  • Every software company uses version control
  • Git knowledge is tested in interviews (directly and indirectly)
  • Understanding Git internals demonstrates systems thinking
  • Branching strategies affect team productivity and deployment safety
  • Git is a content-addressable filesystem — understanding it teaches fundamental CS concepts

Chapter Outline

TopicDescription
Git InternalsObjects, refs, HEAD, index, packfiles
Git Fundamentalsinit, clone, add, commit, status, log, diff
Branching & Mergingbranches, merge, fast-forward, merge conflicts
Rebasingrebase, interactive rebase, rebase vs merge
Stashingstash, stash pop, stash apply, stash branch
Advanced Operationscherry-pick, revert, reset, reflog, bisect
Remote Operationsfetch, pull, push, remote tracking, upstream
Tags & Releaseslightweight tags, annotated tags, semver
Git Hookspre-commit, pre-push, commit-msg, server-side
Worktrees & Submodulesworktree management, submodule workflows
Git Workflowstrunk-based, GitFlow, GitHub Flow, release strategies
GitHub & Code ReviewPRs, code review, branch protection, Actions
Git Interview Questionscommon questions, traps, scenarios
Git Cheat Sheetquick reference for all commands

Git Architecture at a Glance

Working Directory  →  Staging Area (Index)  →  Repository (.git)  →  Remote
    (files)            (git add)                (git commit)         (git push)

Key Concepts

ConceptDescription
BlobStores file content (not filename)
TreeMaps filenames to blobs (like a directory)
CommitPoints to a tree + metadata (author, message, parent)
RefA pointer to a commit (branch, tag, HEAD)
IndexStaging area between working tree and repository
HEADSpecial ref pointing to the current branch/commit

References