Stashing & Branching Workflows
Compare Trunk-Based Development with the Gitflow workflow: which is better suited for Continuous Deployment and why?
How do you stash only specific files or include untracked files when stashing?
How does git stash work internally, and where does the data go when you "pop" it?
What are the risks of keeping a feature branch open for several weeks, and how does this impact the eventual merge process?
What is the difference between git stash pop and git stash apply, and when would you choose one over the other?
What is the forking workflow, and how does it differ from a shared-repository feature-branch workflow?
Navigating & Inspecting History
Explain how git bisect works: how does it use binary search to find a bug, and what is the requirement for the commit history for it to be effective?
Explain the difference between git checkout, git switch, and git restore.
How can you filter and format git log output to inspect history effectively?
How does git blame work, and what kind of question does it help you answer?
What does git rm --cached do, and when would you use it?
Fundamentals & Architecture
Explain the 'Three Trees' or 'Three States' model in Git: what is the conceptual difference between the Working Directory, the Staging Area (Index), and the Repository?
Explain the difference between "Plumbing" and "Porcelain" commands in Git.
What is the difference between a tracked, untracked, and ignored file in Git?
What is the fundamental architectural difference between Git and a centralized VCS like SVN or Perforce, and why does Git allow you to work offline?
What is the point of version control, and what problems does it solve for a development team?
What is the purpose of .gitignore vs. .gitattributes?
What is the purpose of the .git directory, and what would happen if you deleted it?
Why does Git have a staging area instead of committing directly from the working directory?
Remotes Fetch Push & Clone
Explain the difference between an "Upstream" branch and a "Tracking" branch.
How do you migrate a Git repository to a new server using only Git commands?
What does git push -u (set upstream) do, and how does it change future push/pull behavior?
What does it mean to 'prune' a remote, and why might your local list of remote branches still show branches that were deleted on the server?
What happens under the hood when you run git clone?
What is a 'remote-tracking branch' like origin/main, and how is it different from your local main branch?
What is a "Refspec," and how does Git use it during a fetch or push operation?
What is git pull --rebase, and why might a team prefer it over a default pull?
What is the difference between git fetch and git pull, and why is git pull often described as a 'shortcut'?
What is the difference between git push --force and git push --force-with-lease, and why is the latter preferred in a professional environment?
What is the difference between origin and upstream when working with multiple remotes, and how is this used in a forking workflow?
Rebasing & History Rewriting
Explain the difference between git merge and git rebase, and when you would choose one over the other.
How does git cherry-pick work, and in what specific scenario is it better than a merge?
How would you permanently remove a sensitive file (like a leaked secret) from the entire Git history, and what tools would you use?
What does rebase --onto let you do that a normal rebase cannot?
What happens to commit hashes during a rebase?
What is an "Interactive Rebase," and when would you use "Squash" vs. "Fixup"?
What is git rerere and when is it useful?
What is rebase autosquash, and how does it work together with fixup/squash commits?
What is the "Golden Rule" of rebasing, and what happens if you break it?
Explain the difference between git reset --soft, --mixed, and --hard, and what happens to the staging area and working directory in each case?
If you are in the middle of a complex merge or rebase and realize you've made a mistake, how do you return the repository to its exact state before the operation started?
What is git reflog expire, and how long are unreachable commits kept before they can be garbage collected?
What is the difference between git clean and git reset?
What is the difference between git reset and git revert, and which one is safer for public history and why?
What is the reflog, how does it differ from git log, and how can it be used to recover a 'deleted' branch?
Explain the difference between the "Author" and the "Committer" in a Git commit object.
How do you create an empty commit, and in what situations is that useful?
How does the index/staging area let you build up a commit with only part of your changes, e.g. with git add -p?
What is a signed commit or signed tag, and why would a team require GPG/SSH signing?
What is the difference between git commit --amend and a standard commit?
What is the difference between git status and git diff in terms of the three areas?
What makes a good commit message, and why does Git separate the summary line from the body?
Explain the Git object model. What are the four main types of objects?
How does Git compute object IDs (hashes)?
How does Git ensure data integrity?
How does Git store a commit internally: does it store diffs or snapshots?
How does Git’s content-addressable storage work, and what role does the SHA-1 hash play?
How would you manually create a commit using only plumbing commands?
What are dangling objects, and how do git fsck and the reflog relate to them?
What does HEAD point to in Git, and what is a symbolic ref?
What exactly is a 'ref' in Git, and where are refs stored inside the .git directory?
What exactly is stored inside a Git commit object?
What happens inside the .git/objects/ directory before and after a git gc?
What is the commit DAG, and how do parent pointers form the shape of your history?
What is the difference between a blob object and a tree object?
What is the difference between a loose object and a packfile, and why does Git pack objects?
What is the SHA-1 to SHA-256 transition in Git about, and why is it happening?
Why does Git use SHA-1 (or SHA-256) hashes for commits instead of simple incrementing version numbers?
How do you handle a merge conflict conceptually?
How do you revert a merge commit, and why is it trickier than reverting a normal commit?
How does a three-way merge determine the merge base, and why is it needed?
What are the different merge strategies in Git (ort/recursive, ours, octopus), and when does each apply?
What are the trade-offs of using git merge --no-ff?
What is a 'Fast-Forward' merge and when is it not possible?
What is a 'Squash and Merge' and why would a team choose it?
What is a "Merge Conflict," and how does Git determine that a conflict has occurred?
What is an 'Octopus Merge' and when would you use it?
What is the difference between a 'Fast-forward' merge and a 'Three-way' (recursive/ort) merge, and when will Git be unable to perform a fast-forward?
What is the difference between git merge --no-ff and git merge --squash, and when would a team prefer one over the other?
What tools does Git give you to resolve a merge conflict, such as choosing ours/theirs or using a mergetool?