Two operations stapled together. Know which staple.
Run git fetch followed by either git merge or git rebase. Convenient. Also the easiest way to surprise yourself with a merge commit when you didn't want one.
pull = fetch + (merge or rebase), depending on pull.rebase config. Default behavior is merge: a merge commit appears if you and upstream both moved. With pull --rebase your local commits are replayed on top of the upstream tip — linear history, but rewritten.
git pull [<options>] [<repository> [<refspec>...]]| Flag | What it does |
|---|---|
--rebase[=true|false|merges|interactive] | Use rebase instead of merge. |
--ff-only | Refuse if a fast-forward isn't possible. Safer default for some workflows. |
--no-commit | Like merge --no-commit — stage the merge but let you edit before committing. |
--all | Pull from all remotes. |
--autostash | Stash dirty changes before pulling, pop after. |
$ git pull$ git pull --rebase$ git pull --ff-only$ git pull --autostashpull.rebase = true and pull.ff = only globally. You'll thank yourself.git pull.git fetch && git rebase origin/main.pull.rebase=false, both sides moved.pull --rebase rewrites your local commits. If you've already pushed, you'll need --force-with-lease afterwards.--autostash or commit/stash first.Hit each option, then Check answers. Score is recorded; Next is always open.