Git pull 出现 hint 时的解决方案
当我们 git pull,有时会出现如下的提示
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.
简单的说,git pull 默认不带参数时,会有多种可能的选择,git 需要我们去显示指定一下
本地和远程都基于某分支做了不同的修改,且无冲突
- 若希望产生额外的合并 log
- git config pull.rebase false
- 若不希望产生额外的合并 log
- git config pull.rebase true
- 若希望拒绝自动合并
- git config pull.ff only
- 若希望产生额外的合并 log
本地没有做修改
- 选哪种都一样
个人建议使用 git config pull.rebase true,这样会自动合并本地和远程提交,且没有额外的多余 log 信息