git pull 后不自动合并代码问题

记录一下遇到 git pull之后出现异常 控制台日志

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
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 failed with a fatal error.
Git failed with a fatal error.
Need to specify how to reconcile divergent branches.

修改 pull 的默认配置为 rebase
git pull = git fetch + git merge
执行 git pull 命令时,默认是用 git merge 来合并代码的。大家都知道,用 merge 合并代码的节点不在一个分支上,不方便查看节点信息,所以很多公司是采用 git rebase 来合并代码的。针对这种情况,可以在自己的电脑终端,修改 git 的全局配置,将 pull 的默认配置改为 rebase。
全局修改 pull 的命令:
git config --global --add pull.rebase true 划重点!!!
查看是否修改成功命令:
git config --global -l

你可能感兴趣的:(git pull 后不自动合并代码问题)