Progress:
TIER 1 · MODULE 20· Basics

git pull

Two operations stapled together. Know which staple.

🎯 What & why

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.

🧠 Mental model

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.

🛠️ Synopsis

git pull [<options>] [<repository> [<refspec>...]]

🎚️ Switches & options

FlagWhat it does
--rebase[=true|false|merges|interactive]Use rebase instead of merge.
--ff-onlyRefuse if a fast-forward isn't possible. Safer default for some workflows.
--no-commitLike merge --no-commit — stage the merge but let you edit before committing.
--allPull from all remotes.
--autostashStash dirty changes before pulling, pop after.

💡 Use cases

🧪 Examples

Standard pull on the current branch.
$ git pull
Rebase instead of merging.
$ git pull --rebase
Refuse non-fast-forward (safe).
$ git pull --ff-only
Pull with autostash so dirty work doesn't block it.
$ git pull --autostash

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.