使用Git Flow合并分支,使分支保持活动状态 [英] Merge a branch with Git Flow keeping the branch still alive

查看:146
本文介绍了使用Git Flow合并分支,使分支保持活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用 git flow ,并且我知道这样做:

I'm starting using git flow and I understand that doing:

git flow feature start my-feature
git flow feature finish my-feature

我创建一个功能,然后在完成更改后将其与developer分支合并. 完成流命令实际上会在合并操作后删除功能分支.

I create a feature and then, when i've finished my changes, I merge it with the develop branch. The finish flow command literally delete the feature branch after the merge action.

我的问题是:有没有办法使用git flow合并我的功能与开发,并且合并后不删除.

My question is: is there any way using git flow to merge my feature with develop without deleting it after merge.

我的第二个问题是:此工作流程是否正确??我的意思是,在与开发合并时保持活动的功能分支正确吗,只是为了对主"分支进行一些更改并保持在功能分支上工作?

And my second question would be: is this workflow correct? I mean, is it right keeping alive feature branches while merging with develop, just to update the 'main' branch with some changes and keeping to work on the feature branch?

推荐答案

只需使用git flow feature finish -k my-feature

参考: https://github.com/nvie/gitflow/wiki/命令行参数

关于第二个问题:

您通常不会将要素分支重复合并到develop中.您可以将develop合并到功能分支(即相反),或将功能分支重新设置到developHEAD(推荐).将功能分支合并到develop中的唯一时间是完成功能的开发.
如果将要素分支合并到develop中,则将完全消除拥有要素分支的好处,而直接在develop上进行开发即可.
如果您觉得有必要从功能分支合并到develop中,则很可能进行了与该特定功能不直接相关的更改,并且应该首先在develop中进行了更改.

You normally don't merge feature branches repeatedly into develop. You merge develop into the feature branches (i.e. the other way around) or rebase the feature branches onto the HEAD of develop (recommended). The only time when you merge a feature branch into develop is when you finished the development of the feature.
If you merge feature branches into develop you completely remove the benefit of having a feature branch and you just could have developed directly on develop.
If you feel you have the need to merge from a feature branch into develop you most likely made changes that are not directly related to that specific feature and should have been made in develop in the first place.

这篇关于使用Git Flow合并分支,使分支保持活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆