Interview Q&A / Git & GitHub

INTERVIEW Q&A · 97 QUESTIONS

Git & GitHub interview questions

Branching, merge vs rebase, resolving conflicts and pull requests, the way teams actually work.

  1. What do you need before you can use git bisect?

    A known bad commit, a known good commit earlier in history, and a way to test the bug at each step, either by hand or with a script. A clean working tree also helps.

    BeginnerQuick answer1 min read
  2. What is the difference between git bisect and git blame?

    git blame shows who last changed each line of a file and in which commit. git bisect finds which commit introduced a behavior by testing the project at different points in history.

    BeginnerQuick answer1 min read
  3. What if you cannot test a commit during git bisect?

    Run git bisect skip. Git moves to a nearby commit instead. If too many are skipped, it may only narrow the bug to a range of commits rather than one.

    IntermediateQuick answer1 min read
  4. What is git bisect, and when would you use it?

    git bisect does a binary search through commit history to find the exact commit that introduced a bug. You mark one good and one bad commit, and Git checks out midpoints until it finds the first bad one.

    IntermediateQuick answer1 min read
  5. How can you automate git bisect with a script?

    Use git bisect run with a command that exits 0 for good and non-zero (except 125) for bad. Git then runs it at each step and finds the culprit commit without manual answers.

    AdvancedQuick answer1 min read