git pull 后不自動合并代碼問題

記錄一下遇到 git pull之后出現(xiàn)異常 控制臺日志

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
執(zhí)行 git pull 命令時,默認是用 git merge 來合并代碼的。大家都知道,用 merge 合并代碼的節(jié)點不在一個分支上,不方便查看節(jié)點信息,所以很多公司是采用 git rebase 來合并代碼的。針對這種情況,可以在自己的電腦終端,修改 git 的全局配置,將 pull 的默認配置改為 rebase。
全局修改 pull 的命令:
git config --global --add pull.rebase true 劃重點?。?!
查看是否修改成功命令:
git config --global -l

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容