04 / 09

What is branching in Git?

A branch is a parallel line of development. The default branch is usually main or master. Branches allow isolated work without affecting the main codebase.

Difficulty: 4/10
Topics: branch creation, merge workflow, conflict resolution

Scenario Questions

0-2 years experience
  1. 1

    We need a new feature branch off develop. Walk me through the exact git commands you’d run and why.

  2. 2

    If you accidentally commit directly to main, how would you move that commit onto a new feature branch without losing history?

  3. 3

    After finishing a feature, what steps do you take to merge it back while keeping the main branch stable?

2-5 years experience
  1. 1

    Our team follows GitFlow, but a critical hotfix is required now. Explain how you’d use branches to deliver the hotfix without blocking ongoing feature work.

  2. 2

    During a merge of a feature branch into develop you hit a conflict in a shared config file. How do you resolve it and prevent similar conflicts later?

  3. 3

    A merge of a long‑lived feature branch caused the CI pipeline to fail. How would you investigate whether the problem is the merge strategy or branch divergence?

5-8 years experience
  1. 1

    The monorepo has dozens of active branches and CI is slowing down. How would you redesign the branching strategy to improve throughput while preserving stability?

  2. 2

    Compare short‑lived feature branches with frequent rebases versus long‑lived branches with merge commits. What are the trade‑offs for code review, CI load, and history readability?

  3. 3

    Someone rebased a shared branch and force‑pushed, breaking downstream builds. How do you recover the branch and put safeguards in place?

8+ years experience
  1. 1

    We’re migrating from SVN to Git across multiple product lines and want to keep the existing branching model. How would you plan the migration to map SVN branches, preserve history, and minimize disruption?

  2. 2

    Multiple autonomous squads share a core library but have independent release cadences. How would you structure branching and releases to enable independent delivery while avoiding integration hell?

  3. 3

    Discuss the long‑term maintenance implications of moving from a GitFlow model to trunk‑based development as the organization scales from 50 to 500 engineers.

Follow-up Questions

  • Why would you prefer rebasing over merging in that scenario?
  • What impact does that choice have on the CI pipeline?
  • How would you communicate the branching decision to the rest of the team?