简体   繁体   English

“合并提交”是否应该合并回 dev 分支?

[英]Should “merge commit” be merged back into the dev branch?

We use Gitlab for our project, and we have two long-lived branches: dev and master, similar to the Git Flow.我们的项目使用 Gitlab,我们有两个长期存在的分支:dev 和 master,类似于 Git 流程。 And We're using the "merge commit" method, which will create a merge commit in the master branch.我们正在使用“合并提交”方法,它将在主分支中创建一个合并提交。

However, the master branch will always ahead of the dev branch because of those "merge commit".但是,由于那些“合并提交”,master 分支将始终领先于 dev 分支。

在此处输入图像描述

so, my question is, should I merge those "merge commit" back to the dev branch?所以,我的问题是,我应该将那些“合并提交”合并回开发分支吗? And Why?为什么?

Should “merge commit” be merged back into the dev branch? “合并提交”是否应该合并回 dev 分支?

No, unless you want dev to get changes from master (which could have been modified from other branches, like an hotfix)不,除非您希望dev从 master 获取更改(可能已从其他分支修改,例如修补程序)

If dev is long-lived, you merge it to master , but you don't merge master to dev .如果dev是长期存在的,则将其合并到master ,但不要将master合并到dev

Is your dev branch like the master branch?你的 dev 分支和 master 分支一样吗? If you want to have a branch based on the master, you can use:如果你想有一个基于master的分支,你可以使用:

$ git checkout -b branchname master $ git 结帐-b 分支名主

Or if you want to update a branch with the master branch, you can use:或者如果你想用 master 分支更新一个分支,你可以使用:

$ git merge branchToUpdate master $ git 合并分支到更新主

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM