05 / 09

Explain the basic Git workflow.

  1. 1

    Working Directory – Modify files.

  2. 2

    Staging Area (Index) – git add to stage changes.

  3. 3

    Local Repository – git commit to save changes.

  4. 4

    Remote Repository – git push to upload changes.

Difficulty: 2/10
Topics: branching, commits, pull requests

Scenario Questions

0-2 years experience
  1. 1

    You need to add a small bug‑fix to a repository you just cloned. Walk me through the exact Git commands you would run from start to finish, including how you would get your change into the main branch.

  2. 2

    After committing a file that contains an API key, you realize it’s already been pushed. Which Git commands would you use to remove it from the repository history and prevent it from appearing in future clones?

2-5 years experience
  1. 1

    Your team works with feature branches and a CI pipeline. A pull request fails because the target branch has moved ahead since you started your work. How would you resolve the situation and get the PR back to a green state?

  2. 2

    During a release you notice a hot‑fix was applied directly to the release branch but never merged back into develop. Explain how you would integrate that fix without breaking the ongoing release cycle.

5-8 years experience
  1. 1

    In a monorepo with hundreds of engineers, the current Git workflow is causing large merge commits and long CI times. Propose a revised workflow, including any branch‑protection rules, rebasing policies, or tooling you would introduce, and discuss the trade‑offs.

  2. 2

    Our organization wants to move toward trunk‑based development while still allowing isolated feature work. How would you adapt the basic Git workflow to support this, and what safeguards would you put in place to avoid integration pain?

8+ years experience
  1. 1

    We are migrating several legacy SVN projects to Git across multiple product lines. Design a migration plan that preserves history, integrates with existing CI/CD pipelines, and minimizes developer disruption.

  2. 2

    At scale, you need a governance model for Git that supports cross‑team releases, independent feature development, and occasional emergency hot‑fixes. Describe the architecture of that model, including branch protection, automation, and how you would handle exceptions or legacy codebases.

Follow-up Questions

  • What would you do if the PR shows merge conflicts?
  • How do you keep your branch up‑to‑date with the main branch during development?
  • Can you explain why you might choose rebase over merge in this workflow?