git pull is git fetch followed by a merge of origin/main into your branch. When you have no commits of your own, the merge is a fast-forward:
git pull
Updating af906b0..2e7b3fa
Fast-forward
post.md | 1 +
1 file changed, 1 insertion(+)
From https://github.com/monster-market/blog.git
af906b0..2e7b3fa main -> origin/mainWhen you and GitHub both have new commits, the branches have diverged. Git stops and asks how you want them combined:
git pull
From https://github.com/monster-market/blog.git
af906b0..00f8d2c main -> origin/main
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.Choose merge, once, for every project on this computer:
git config --global pull.rebase falseThe next git pull merges, and opens the merge message in the editor panel. Save it:
git pull
hint: Waiting for your editor to close the file...
Merge made by the 'ort' strategy.
post.md | 1 +
1 file changed, 1 insertion(+)
git log --oneline --graph
* ea5c934 (HEAD -> main) Merge branch 'main' of https://github.com/monster-market/blog.git
|\
| * 00f8d2c (origin/main, origin/HEAD) Write the second post
* | c3adf11 Add an about page
|/
* af906b0 Start the blogObjectives
- Tell git to merge when you pull diverged work.
- Pull Sam's commit into yours.