You are new to a team. How do you collaborate daily without stepping on others' toes?
BeginnerScenarioRemotes, Collaboration and Pull Requests
Answer
Situation read → The risk is stale branches and surprise conflicts.
What I'd do →
- Start each task from fresh
main:git fetch && git switch -c feature/ABC-123 origin/main. - Commit small and often; push early so CI and teammates see it.
- Before opening a PR:
git fetch && git rebase origin/main, run tests. - Never push directly to
main; always use a PR.
Why → Short-lived branches have small diffs, so conflicts are smaller and rarer.
Interview tip → Say "fetch first, then decide merge or rebase", not blind git pull.
More on Remotes, Collaboration and Pull Requests
You 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?AdvancedWhy do you use `--force-with-lease`, and when does it still hurt?Intermediate