Error:
yesterday i pull one of the remote repository branch i got warning
warning: Pulling without specifying how to reconcile divergent branches is
discouraged. You can squelch this message by running one of the following
commands sometime before your next pull:
git config pull.rebase false # merge (the default strategy)
git config pull.rebase true # rebase
git config pull.ff only # fast-forward only
You can replace "git config" with "git config --global" to set a default
preference for all repositories. You can also pass --rebase, --no-rebase,
or --ff-only on the command line to override the configured default per
invocation.
Solution
git config --global pull.ff only
another way
git config pull.rebase false
When you encounter an error while pulling a branch and Git suggests using git config pull.rebase false, it means that the error is related to Git's default behavior during the pull operation. By setting pull.rebase to false, you are instructing Git to perform a regular merge instead of rebasing when pulling changes from a remote branch.
Rebasing and merging are two different ways of incorporating changes from one branch into another. Rebasing moves your local changes to the tip of the remote branch's history, while merging combines the remote branch's changes with your local branch's changes.
To resolve the issue and apply the suggested configuration, follow these steps:
Open a terminal or command prompt.
Navigate to your Git repository directory (if you are not already there).
Set the pull.rebase configuration to false by running the following command:
git config pull.rebase false
This will update the Git configuration for your current repository and ensure that Git uses regular merging instead of rebasing during the pull operation.
Now, try pulling the branch again:
git pull
Git should perform a regular merge and incorporate the changes from the remote branch into your local branch without any errors.
Keep in mind that using git pull with pull.rebase false will perform a merge by default, but you can still explicitly choose to rebase during pull using the --rebase option, if needed:
git pull --rebase
By default, the pull.rebase setting is true, which means that git pull will perform a rebase. Changing it to false will make git pull behave like a merge by default.
Reference
Reference1
Reference2
Top comments (0)