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

After a PR merged and the branch was deleted on GitHub, `git pull` complains about your branch.

BeginnerScenarioRemotes, Collaboration and Pull Requests
Answer

Situation read → Your local branch tracks a remote branch that no longer exists ([gone]).

What I'd do →

  1. git fetch --prune clears the stale remote-tracking ref.
  2. git branch -vv shows branches marked : gone].
  3. Delete them: git branch -D old-feature.
  4. Set git config --global fetch.prune true.

Why → Git never deletes remote-tracking refs unless asked.

Interview tip → A one-liner to clean all gone branches is useful, but check the list first.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests