git-novice
git-novice copied to clipboard
Add note about new git pull message to instructor guide
Recent versions of git introduce a warning message when you run git pull
without specifying how to reconcile divergent branches. A discussion of the options probably exceeds what we can do in a workshop, but instructors may want to show learners how to suppress this potentially distracting warning.
@lo5an will you verify that this message is still produced, and under what conditions? Since the lesson does not delve into branches, it seems out of scope. Also, I cannot produce the message.
It looks like git was updated at the end of 2020 so that the message isn't displayed when a fast-forward merge is possible. I'm seeing this behavior now on my workstation with git version 2.31.1
People will still see the warning message in non fast-forward merge situations:
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 649 bytes | 649.00 KiB/s, done.
From github.com:lo5an/test123
63ffc2c..d56e999 main -> origin/main
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
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.
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
If you don't mind, I'm going to put a "wait" tag on this. It looks like there are still PRs and discussion about this and the various git pull
options over at the Git repo.
As an aside, I'm running Git version 2.32.0.windows.2 and am still not seeing the behavior. When I dug into the different git config --list
options, I found pull.rebase=false
configured at the system level, meaning Git-bash or Git automatically added the configuration because I can't edit the system options.
Sounds good. It's definitely an edge case, especially if Git for Windows is configuring the option at the system level.
Last month I updated my Mac to Big Sur and had to reinstall git. I am now at version git version 2.30.1 (Apple Git-130)
. When I did my first git pull
on a repo that was already up to date, I got the message:
$ git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
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.
Already up to date.
This could imply that some learners with recent versions of git get this message. It may be worth checking with folks that have recently taught this lesson.
As an aside: is the default strategy git config pull.rebase false
the most sound one?
I'm going to close this PR in preparation of the new workbench lesson infrastructure. I will leave the label in place, so it is easier to get back to the original solution when revisited.