git pull: Usage, Options & Common CI Errors
git pull is git fetch followed by an integration step (merge or rebase).
Pull updates your branch with remote changes. In CI you almost always want --rebase or --ff-only for predictable results.
What it does
git pull runs git fetch to get new commits, then merges (default) or rebases them onto your current branch.
Common usage
Terminal
git pull
git pull --rebase origin main
git pull --ff-only # fail instead of creating a mergeOptions
| Flag | What it does |
|---|---|
| --rebase | Rebase local commits instead of merging |
| --ff-only | Only fast-forward; error if a merge is required |
| --no-rebase | Force a merge integration |
| --autostash | Stash/unstash dirty changes around the pull |
Common errors in CI
fatal: Need to specify how to reconcile divergent branches - newer Git refuses to guess. Pick one: git config pull.rebase true (or pull.ff only). "Your local changes would be overwritten by merge" means a dirty tree; commit, stash, or use --autostash first.
Related guides
git fetch: Usage, Options & Common CI Errorsgit fetch downloads remote objects and refs without touching your working tree. Reference for --depth, --unsh…
git merge: Usage, Options & Common CI Errorsgit merge joins two branch histories into one. Reference for --no-ff, --squash, --abort, and how to detect an…
git rebase: Usage, Options & Common CI Errorsgit rebase replays commits onto a new base to keep history linear. Reference for -i, --onto, --continue, --ab…
git push: Usage, Options & Common CI Errorsgit push uploads local commits to a remote. Reference for -u, --force-with-lease, and tags, plus the rejected…