git pull --rebase vs --merge — which to use

# Rebase: linear history, no merge commits (recommended for most teams)
git pull --rebase origin main

# Merge: explicit merge commit showing branches converged (default behavior)
git pull origin main

--rebase rewrites your local commits on top of the remote ones. --merge creates a merge commit. Both end up with the same content.

Set rebase as the default for all pulls

git config --global pull.rebase true

History shape: rebase vs merge

# Rebase result (linear):
A - B - C - D'  (your commit rebased on top)

# Merge result (graph):
A - B - C - M   (M = merge commit)
         \   /
          D

When to prefer --merge

Use merge when you want the history to explicitly show that two branches were combined — common on long-lived integration branches.

git pull --no-rebase origin main    # equivalent to --merge