Gitの警告"You have divergent branches and need to specify how to reconcile them."は、pull時分岐したブランチに対する設定を明確にすることで解決する。
Gitのpullを行なった際の警告"You have divergent branches and need to specify how to reconcile them."は、pull時分岐したブランチに対する設定(config)を明確にすることで解決する。
code:zsh
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: 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.
ざっくり意訳
分岐しっ放しの複数のブランチがあるため、それらに対してどう操作(調節)を行うか、挙動を明確にしなければなりません。
pullする前に以下のコマンドを実行すれば、この設定を行うことができます。
git config pull.rebase false # mergeで取り込む。 (デフォルト)
git config pull.rebase true # rebaseで取り込む。
git config pull.ff only # fast-forwardで取り込む。
これらのコマンドに--globalオプションをつけておけば、全リポジトリのデフォルト設定として設定できます。
また、pullするたびに--rebase, --no-rebase, --ff-onlyとオプションをつければ、デフォルト設定の挙動とはまた違う挙動でpullを行うことができます。
なぜ?
2020/6/1のGit 2.27.0から発生するようになった警告
これらの三種類の挙動をユーザーに区別させることで混乱を減らす目的。
解決方法
configを用いて、pull.rebase, pull.ffのいずれかの設定を明確化する。
pullをする毎に毎にオプションをちゃんと指定する。
参考
Git 2.27.0 から git pull をすると表示されるようになった "Pulling without specifying how to reconcile divergent branches is discouraged." について
https://blog.agile.esm.co.jp/entry/git-warns-pulling-without-specifying-how-to-reconcile-divergent-branches
fast forward, no fast forward