dev分支和master是什么_将master合并到分支和将分支合并到master中有什么区别?

I have a branch called master and another called dev. Usually, I do tests and improvements on dev, and when decided it is OK, I merge it into master, then tagging and release new version of the application. I met two cases of merging:

merge master into dev, and

merge dev into master,

but I am not really sure how the two are different... Any explanation would be welcome.

解决方案

TL;DR

The main difference lies in where the master and dev branches end up pointing.

Full explanation

Merging one branch into another is not a symmetric operation:

merging dev into master, and

merging master into dev,

are, in general, not equivalent. Here is an illustrative example that explains the difference between the two. Let's assume your repo looks as follows:

If you merge dev into master

If master is checked out (git checkout master),

and you then merge dev (git merge dev), you will end up in the following situation:

The master branch now points to the new merge commit (F), whereas dev still points to the same commit (E) as it did before the merge.

If you merge master into dev

If, on the other hand, dev is checked out (git checkout dev),

and you then merge master (git merge master), you will end up in the following situation:

The dev branch now points to the new merge commit (F', whereas master still points to the same commit as it did before the merge (D).

Putting it all together

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值