使用Git Flow时如何保持分支同步 [英] How to keep branches in sync when using Git Flow

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

问题描述

这是我们目前遵循的工作流程:


  1. 完成一项功能并将其合并到 develop branch

  2. 从开发中创建版本分支

  3. 运行构建脚本 release 分支

  4. 创建一个将版本分支合并到 master

  5. 接受版本分支拉取请求并合并

  6. 然后,可以通过运行deploy命令将 master 分支部署到活动服务器。

这一切都很好,除了在我的Git repo中,我的分支不同步 master 现在位于 develop 版本分支到 develop 发生的合并提交。但是 master 还在 develop 之前,因为它现在包含来自pull请求的合并提交以获得 release 分支到 master



我可以点击Bit Bucket以获得所有分支的更新,但这只是一个奇怪的过程,并且会更好地让分支自动同步。



或者,它们不同步并不重要?



以下是Git Flow流程的链接,以防您不熟悉它: http://nvie.com/posts/a-successful-git-branching-model/

谢谢。

解决方案

合并开发也推动更新的开发分支或从主创建一个新的分支。如果您将开发和推送合并,那么每个有权开发的人都将在下次更新时获得更新的开发分支。



您的主控和远程主控不同步,因为您没有从远程进行更新。你必须这样做! :)



添加 nwinkler 的回答为更好的可视性作为答案:


在发布后您需要重新合并到开发中。在我们的工作流程中,我将主分支合并到发布后的开发中。通过这种方式,您可以从版本合并中获得所有更改,并且确保您可以在执行下一个版本时将所有内容合并到主版本中。看起来你的工作流程中缺少了最后一步

如果你有什么想要的,请接受并关闭它!



希望它有帮助!


This is the workflow we currently follow:

  1. Finish a feature and merge it into develop branch
  2. Create a release branch from develop
  3. Run build scripts on release branch
  4. Create a pull request to merge the release branch into master
  5. Accept the release branch pull request and merge
  6. The master branch can then deploy to live server by running deploy command

This all works great, except in my Git repo my branches are out of sync master is now behind develop because it doesn't have the merge commits that happened from the pull request merging the release branch into develop. But master is also ahead of develop as it now contains merge commits from the pull request to get the release branch into master

I am able to click sync in Bit Bucket to get all the branches up to date, but this just feels like an odd process to go through and would be nicer to keep the branches in sync automatically.

Or, does it not really matter that they are out of sync?

Here is a link to Git Flow process in case you are unfamiliar with it: http://nvie.com/posts/a-successful-git-branching-model/

Thanks.

解决方案

When you merge the release branch to master you either merge develop also and push the updated develop branch or create a new one from the master. If you merge develop and push then everyone who has access to develop will get updated develop branch on next update.

Your master and remotes master are out of sync as you have not taken update from the remote. This you have to do! :)


Adding nwinkler's answer for better visibility as answer:

You need to merge back into develop after doing the release. In our workflow, I merge the master branch back into develop after the release. That way you get all of the changes from the release merge and you make sure that you can merge everything into master when you do the next release. Looks like that last step is missing from your workflow

If you got what you wanted then please accept it and close it!

Hope it helped!

这篇关于使用Git Flow时如何保持分支同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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