idea 中git 常见问题解决

最近在项目开发中,因为升级了系统版本 把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.rebasetrue时,运行不带选项的命令git pull相当于执行git pull --rebase
  • pull.rebasefalse时,运行不带选项的命令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命令:禁止快进合并,即不管能不能快进合并,最后都会进行正常合并生成一个新的提交。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值