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

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 →

  1. Start each task from fresh main: git fetch && git switch -c feature/ABC-123 origin/main.
  2. Commit small and often; push early so CI and teammates see it.
  3. Before opening a PR: git fetch && git rebase origin/main, run tests.
  4. 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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests