git checkout master # 切换到分支master
git merge dev # 在分支master上合并分支dev
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 当发生冲突, 选他们的