技术思绪摘录旅行笔记
在开发中,经常会遇到代码冲突,有时候是因为没有拉取,导致几个客户端都提交了,同步的时候,git无法帮你选择用谁的代码,需要你给他协调一下怎么解决冲突。备忘一下

在开发中,经常会遇到代码冲突,有时候是因为没有拉取,导致几个客户端都提交了,同步的时候,git无法帮你选择用谁的代码,需要你给他协调一下怎么解决冲突。

一般会遇到下面的错误提示

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
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.

应该选择哪个作为默认的行为?

这个的意思是,你在 pull 时遇到冲突的时候,使用那种合并方式:

merge:最普遍的方式,拉下来解决冲突
rebase:使用变基方式,不会产生无用 commit
fast-forward:快进方式,只拉取没有冲突的


CarsonIT 微信扫码关注公众号 策略、创意、技术

留下您的脚步

 

最近评论

查看更多>>

站点统计

总文章数:275 总分类数:18 总评论数:88 总浏览数:124.82万

精选推荐

阅读排行

友情打赏

请打开您的微信,扫一扫