Interview Prep/Git & GitHub/Rebase, Cherry-pick and History Rewriting

Your history is full of "Merge branch 'main' into feature" noise from `git pull`.

BeginnerScenarioRebase, Cherry-pick and History Rewriting
Answer

Situation read → Plain git pull merges upstream into your local commits, creating a merge commit each time.

What I'd do →

  1. git config --global pull.rebase true makes pull replay your commits on top.
  2. Or git config --global pull.ff only to refuse non-fast-forward pulls and decide consciously.
  3. Fix an existing branch with git rebase origin/main.

Why → Rebase keeps local work on top of upstream, giving a linear branch.

Interview tip → Newer Git warns until you set pull.rebase, so setting it is part of a good global config.

All Git & GitHub questions Roadmap: Git & GitHub

More on Rebase, Cherry-pick and History Rewriting