[英]Gitflow - Why does no editor open when I finish a feature branch?
I use gitflow on linux.我在 linux 上使用 gitflow。
When I finish a hotfix branch, my vi editor opens and I can write a merge message.当我完成一个修补程序分支时,我的 vi 编辑器会打开,我可以编写合并消息。 The merge message is now in the commit history.合并消息现在在提交历史中。
But when I finish feature branches, no vi editor opens, I can't write no merge message.但是当我完成功能分支时,没有打开 vi 编辑器,我不能写没有合并消息。 So there is no trace in the commit history.所以提交历史中没有任何痕迹。
It's annoying.这很烦人。 Could someone explain me why ?有人可以解释我为什么吗? Is it a config problem ?是配置问题吗?
To create a feature branch: git flow feature start feature_branch
.要创建功能分支: git flow feature start feature_branch
。
To finish a feature branch: git flow feature finish feature_branch
.完成一个功能分支: git flow feature finish feature_branch
。 According the doc finish is similar to: git checkout develop
git merge feature_branch
根据文档完成类似于: git checkout develop
git merge feature_branch
Although I've been using the Git Flow branching strategy for years, I confess I've never used the git flow
commands before, but I just tested them out and can confirm what you're witnessing, though some clarifications are in order.尽管多年来我一直在使用 Git Flow 分支策略,但我承认我以前从未使用过git flow
命令,但我只是对其进行了测试,可以确认您所看到的内容,尽管需要进行一些说明。
As best I can tell, you aren't ever prompted to write a commit message for any of the merge commits .据我所知,您永远不会被提示为任何合并提交编写提交消息。 However, when you finish a hotfix
or release
branch, you are prompted to write the Tag message , which happens to also be included in the merge commit message details (below the commit title), so it may look like you were writing the merge commit message.然而,当你完成一个hotfix
或release
分支时,你会被提示写Tag message ,这恰好也包含在合并提交消息的细节中(在提交标题下面),所以看起来你在写合并提交信息。 Since only releases and hotfixes are tagged, this is why you aren't prompted with an editor when you finish feature branches.由于仅标记了版本和修补程序,这就是为什么在完成功能分支时不会提示您使用编辑器的原因。
Regarding the --no-ff
merges, the following rules are in place:关于--no-ff
合并,有以下规则:
--no-ff
flag.完成发布或修补程序分支时,始终使用--no-ff
标志执行合并。--no-ff
flag.完成具有 2 个或更多新提交的功能分支时,将使用--no-ff
标志执行合并。--ff
flag (which is also the default for merge).当完成一个刚好有 1 个新提交的功能分支时,将使用--ff
标志(这也是合并的默认值)执行合并。 Note that using -ff
in the third rule means it will do a fast-forward if possible, meaning the merge commit is sometimes avoided, which is interesting because AFAIK this isn't suggested anywhere in the Git Flow documentation.请注意,在第三条规则中使用-ff
意味着它会在可能的情况下进行快进,这意味着有时会避免合并提交,这很有趣,因为 AFAIK 在 Git Flow 文档中的任何地方都没有建议这样做。 It does make sense though since there is no information gain from forcing a merge commit when you only have a single commit to merge in. It still stays true to the --first-parent
view of the develop
branch showing all completed feature branches.这确实有意义,因为当您只有一个提交要合并时,强制合并提交不会获得任何信息。它仍然适用于显示所有已完成功能分支的develop
分支的--first-parent
视图。
Side Note: when I personally use Git Flow, I always force the merge commit even for single commit merges, because I put additional PR information in the customized merge commit messages.旁注:当我个人使用 Git Flow 时,我总是强制合并提交,即使是单次提交合并,因为我在自定义的合并提交消息中添加了额外的 PR 信息。 This is one of the reasons I don't use the git flow
commands.这是我不使用git flow
命令的原因之一。 (Besides, our SCM tool handles the merges of completed Pull Requests anyway, so no one would "finish" anything themselves.) (此外,我们的 SCM 工具无论如何都会处理已完成的合并请求,因此没有人会自己“完成”任何事情。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.