Interview Prep/Git & GitHub/Remotes, Collaboration and Pull Requests

Two developers need to work on the same feature branch simultaneously.

IntermediateScenarioRemotes, Collaboration and Pull Requests
Answer

Situation read → Shared branches need tight rules to avoid rewrite pain.

What I'd do →

  1. Agree: no rebase or force-push on the shared branch.
  2. Both run git pull --rebase before each push (rebases only local unpushed commits).
  3. Split by file or module to reduce conflicts, and commit small.
  4. Alternative: each dev uses a personal branch off the feature branch and PRs into it.

Why → Rebasing only your unpushed commits is safe, and rewriting published ones is not.

Interview tip → Personal sub-branches are the cleanest answer.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests