Quiz: Git¶
4 questions
L0 (1 questions)¶
1. What are the three local areas in Git where changes live?
Show answer
Working directory (your actual files on disk), staging area/index (changes queued for next commit via 'git add'), and local repository (committed snapshots stored in .git/). Changes flow: working dir -> staging -> repository -> remote.L1 (1 questions)¶
1. What is the golden rule of rebase, and what happens if you violate it?
Show answer
Never rebase commits that have been pushed to a shared branch. Rebase rewrites commit hashes, so if others have already pulled those commits, their history diverges from the rebased history. This causes duplicate commits, merge conflicts, and confusion. Rebase is safe only for local branches that have not been shared.L2 (1 questions)¶
1. Something broke between Monday and Friday across 25 commits. How do you efficiently find the breaking commit?
Show answer
Use git bisect: 'git bisect start', 'git bisect bad HEAD' (current broken state), 'git bisect goodL3 (1 questions)¶
1. You accidentally committed an API key 3 commits ago. The key has been rotated, but how do you remove it from Git history entirely?