git更新类型update type

一、git type的选择

  1. merge 合并
  2. Rebase 保留本地项目代码
  3. Branch Default 保留远程仓库的代码

 二、区别

这三者如果没有冲突,update的表现方式是没有区别的,但是如果需要更新的文件和远程仓库有差异,就会有不同的表现
2.1 merge

    select this option to perform merge during the update. This is equivalent to running git fetch and then git merge, or git pull --no-rebase.

采用合并的方式来更新代码,此时会产生一个commit,这也是一般常用的默认的操作,这个的好处是能够在log中看到所有的操作记录,但是对于代码洁癖来说,可能会无法接受。
2.2 Rebase

    select this option to perform rebase during the update. This is equivalent to running git fetch and then git rebase, or git pull --rebase (all local commits will be put on top of the updated upstream head).

简单来说就是所有的本地commit都是默认放到远程的commit记录的顶部,log也只会有一条记录线,简洁,但是有时候排查问题会不方便。
2.3 Branch Defalut

    select this option if you want to apply different update strategies for different branches. You can specify the default update type for each branch in the branch. section of the .git/config configuration file.

这个意思是,每个分支都可以设置自己的update方式,可以在config中设置,这个是选择分支默认的方式

三、后记

根据代码习惯和熟练度来使用,一般常用的是merge。
最后右侧默认选择 using stash哈

 

 

  • 6
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在IDEA中,可以使用git pull命令来更新代码。git pull相当于是git fetch + git merge,它会从远程仓库拉取最新的代码并合并到本地分支中。如果想要使用git pull -r,也就是git pull --rebase命令,相当于git fetch + git rebase,它会将本地的提交应用到远程分支的最新提交之上。更新代码非常重要,如果不进行更新,别人有项目提交到服务器上,你的项目将无法提交上去。使用git解决冲突可能会比较麻烦,而且有时候不注意会冲掉别人写的代码。因此,在提交自己的项目之前,必须进行更新操作。在IDEA中,可以选择pull进行更新代码操作,然后将代码add到暂存区,最后才能真正提交到git仓库。 #### 引用[.reference_title] - *1* [Git之IDEA集成Git更新项目Update Type选项解释](https://blog.csdn.net/weixin_42586723/article/details/107103461)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [IDEA中Git更新/提交/还原方法](https://blog.csdn.net/MZ199290/article/details/122648181)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值