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 →
- Agree: no rebase or force-push on the shared branch.
- Both run
git pull --rebasebefore each push (rebases only local unpushed commits). - Split by file or module to reduce conflicts, and commit small.
- 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.
More on Remotes, Collaboration and Pull Requests
You are new to a team. How do you collaborate daily without stepping on others' toes?BeginnerYou are migrating a repo from Bitbucket to GitHub and must keep every branch and tag.IntermediateYou want to contribute a fix to an open-source project you do not have write access to.BeginnerA teammate sent a 3,000-line PR and nobody can review it properly.IntermediateA reviewer asks for changes. How do you update the PR cleanly?BeginnerYour team wants stacked PRs so that large work arrives in small reviewable steps. How do you set it up?Advanced