git-novice icon indicating copy to clipboard operation
git-novice copied to clipboard

How to deal with the message about how to perform `git pull`?

Open lexnederbragt opened this issue 2 years ago • 6 comments

Recent versions of git show this message after a 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.

The lesson does not yet seem to take this change into consideration. What would be a good choice for novices here? I tried to look this up, but am not sure. Many seem to suggest to use the ´fast-forward´ as default, but this may lead to unexpected problems in certain cases?

lexnederbragt avatar Oct 04 '21 08:10 lexnederbragt

Great point. I think a decent option here would be to add --no-rebase to the first mention of "git pull origin main", and then briefly discuss that this avoids a warning from recent version of git. The next line section can then add "git config --global pull.rebase false" to avoid the warning, so that subsequent uses do not require it. We can then provide a link to a document discussing rebasing, or perhaps add another segment discussing it in more detail.

kjjohnsen avatar Oct 13 '21 13:10 kjjohnsen

Cross-reference https://github.com/swcarpentry/git-novice/pull/767

kekoziar avatar Dec 23 '21 18:12 kekoziar

Why not deal with this in Setting Up Git? This seems similar in complexity to the Line Endings issue. Thus, I would think it would make sense, as with that issue, to deal with it at setup and avoid the cognitive load of having it show up when students are trying to understand the complexities of remotes and pull/push.

ellio167 avatar Apr 07 '22 20:04 ellio167

This issue has technically been solved (by #873) but due to a switch of platform it never got merged. This would make a great beginner issue. If not I will look at re-submitting a PR for the new platform.

TomMelt avatar Jul 26 '23 09:07 TomMelt

Flagging this as it has recently come to my attention (though I haven't run into it yet, since my git version is older)

ha0ye avatar Feb 29 '24 17:02 ha0ye

@TomMelt would you still be willing to submit a PR for the new platform?

martinosorb avatar Mar 04 '24 13:03 martinosorb