2020-03-12 git merge合并分支

git checkout master # 切换到分支master

git merge dev # 在分支master上合并分支dev


关于git merge 的详细用法

4、 merge和rebasae用来做分支合并

在分支合并的过程中可能会产生冲突, 无论是merge还是rebase都要先解决冲突。

6、 FAST-FORWARD MERGE

本地在dev分支上且本地未做任何修改, 拉取远程dev分支,则不需要创建提交, 直接用ff即可。

但是如果本地dev做了修改, 则不能用ff, 要创建合并提交。

--no-ff 要创建合并提交。

通常,当前的分支头是命名提交的祖先。这是最常见的情况,尤其是从git pull调用时:您正在跟踪上游存储库,没有提交任何本地更改,现在您希望更新到较新的上游修订版。在这种情况下,不需要新的提交来存储合并的历史记录;相反,头部(连同索引)将更新为指向指定的提交,而不创建额外的合并提交。

使用--no-ff选项可以抑制此行为。

With --ff, when possible resolve the merge as a fast-forward (only update the branch pointer to match the merged branch; do not create a merge commit). When not possible (when the merged-in history is not a descendant(后代) of the current history), create a merge commit.

With --no-ff, create a merge commit in all cases, even when the merge could instead be resolved as a fast-forward.

With --ff-only, resolve the merge as a fast-forward when possible. When not possible, refuse to merge and exit with a non-zero status.

7、_merge_strategies: 合并策略: 冲突策略:

The merge mechanism (git merge and git pull commands) allows the backend merge strategies to be chosen with -s option.

resolve策略:

 It tries to carefully detect criss-cross merge ambiguities and is considered generally safe and fast.

recursive strategy: recursive strategy 的可选项:
patience: 手动解决冲突。

ours 当发生冲突,选我的

thires  当发生冲突, 选他们的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值