1. 程式人生 > 其它 >Git問題解決:warning: Pulling without specifying how to reconcile divergent branches is discouraged.

Git問題解決:warning: Pulling without specifying how to reconcile divergent branches is discouraged.

使用git pull命令出現以下的警告:

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.

該警告的中文版本文案描述如下:

warning: 不建議在沒有為偏離分支指定合併策略時執行pull操作。 
您可以在執行下一次pull操作之前執行下面一條命令來抑制本訊息:

git config pull.rebase false  # 合併(預設預設策略)
git config pull.rebase true   # 變基
git config pull.ff only       # 僅快進

您可以將 "git config" 替換為 "git config --global" 以便為所有倉庫設定
預設的配置項。您也可以在每次執行 pull 命令時新增 --rebase、--no-rebase,
或者 --ff-only 引數覆蓋預設設定。

解決辦法:

若無特殊需求,執行命令
git config pull.rebase false