您当前的位置:首页 > 文章 > idea 中git 常见问题解决 Yo

idea 中git 常见问题解决 You have divergent branches and need to specify how to reconcile the

作者:程序员开心鸭 时间:2023-03-13 阅读数:1764 人阅读
最近在项目开发中,因为升级了系统版本 把git config 配置给弄没了。

然后在 idea 中 提交代码前,使用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.
 

提示很明显解决办法

merge 执行那个命令。因为我这里是手动合并代码

直接在命令行执行 git config pull.rebase false

在执行git pull 就可以

pull.rebase

当pull.rebase为true时,运行不带选项的命令git pull相当于执行git pull --rebase。
当pull.rebase为false时,运行不带选项的命令git pull不会被改变含义,即不会变基。如果想变基,需要在执行命令时显式地加上选项--rebase,即git pull --rebase。
git pull

git pull命令等价于:先执行git fetch,再执行git merge FETCH_HEAD将远程仓库对应分支的最新提交合并到当前本地分支中。
git fetch会查询git remote中所有的远程仓库所包含分支的最新提交,并将其记录到.git/FETCH_HEAD文件中。
.git/FETCH_HEAD是一个版本链接,指向着目前已经从远程仓库取下来的所有分支的最新提交。
git pull的选项及作用

git pull命令:先尝试快进合并,如果不行再进行正常合并生成一个新的提交。
git pull --rebase命令:先尝试快进合并,如果不行再进行变基合并。
git pull --ff-only命令:只尝试快进合并,如果不行则终止当前合并操作。
git pull --no-ff命令:禁止快进合并,即不管能不能快进合并,最后都会进行正常合并生成一个新的提交。
————————————————
版权声明:本文为CSDN博主「程序员开心鸭」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/q1035331653/article/details/128915950

本站大部分文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了您的权益请来信告知我们删除。邮箱:1451803763@qq.com

标签:技术应用