Git · Senior · Question 23 of 76
Why should every commit on main build and pass tests, not just the PR's final state?
- ✓Correct answer: So bisect and reverts work on any commit
- 2So that tags can be placed on any commit
- 3Because Git rejects commits that fail tests
Explanation
If intermediate commits are broken, git bisect lands on failures unrelated to the bug. Squash merges or a "every commit is green" policy avoid that.