Fixing the "Git Pull Origin Warning"

git20-05-2021

TL;DR

Execute any of the following:

For more references: https://git-scm.com/docs/git-pull

Back Story

I was updating my local repository and wanted to make sure my repository is up-to-date with the master or main branch. Then got the following warnings:

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.

Google is our friend (privacy not included)

So I started searching for what rebase and fast-forward means. So here it is:

Merge (the default strategy)

git config pull.rebase false - This keeps the default behavior and suppresses the warning.

Rebase

git config pull.rebase true - This actually commits on top of the remote branch, maintaining a single branch both locally and remotely (unlike the default behaviour where two different branches are involved — one on local and the other on remote — and, to combine the two, a merge is performed).

fast-forward only

git config pull.ff only - This only performs the pull if the local branch can be fast-forwarded. If not, it simply aborts with an error message (and does not create any commits).

Support

Thank you for being a valued reader of my blog! Your support means the world to me and helps me continue to create valuable content for you. Here are a few ways you can show your support:

Author's photo

Herman Menor, Jr.

I'm a traveler, foodie, gamer, baller and trader viewed as a Web Developer and Software Engineer.

See other articles:

undefinedThumbnail

Solving Windows and WSL2 DNS Problem

WSL2 is a feature in Windows allowing users to run Linux directly on their Windows machines, improving performance and compatibility

wsl2, dns22-01-2024

undefinedThumbnail

Ansible Testing Practice

DevOps is already part of my tasks as an experienced Software Engineer and Web Developer. Here are some practice to test your Ansible script.

DevOps25-10-2023