20.1.2021 |

Pulling without specifying how to reconcile divergent branches

Since Git 2.27 i get a warning when pulling.

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.

When you do a git pull origin master, git pull performs a merge, which often creates a merge commit. Therefore, by default, pulling from the remote is NOT a harmless operation: it can create a new commit sha that didn’t exist before. This behavior can confuse a user, because what feels like it should be a harmless download operation actually changes the commit history in unpredictable ways. https://stackoverflow.com/a/62653400/531592

Recommendation

$ git pull --ff-only

or event better as a global default with

$ git config --global pull.ff only
Zur Übersicht
Jan Sauer

Mehr vom Devsquad...

Sven Röttering

Gang of Four Design Patterns

Jan Sauer

Use main as the default branch

Hallo, ich bin Jörg Herbst!

Ich bin der CEO von newcubator und freue mich über jede Nachricht!

* Pflichtfeld