对于我的分支结构,GIT正确的工作流程 [英] GIT correct workflow for my Branch structure

查看:73
本文介绍了对于我的分支结构,GIT正确的工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照特定的工作流程开始实施GIT存储库. 工作流程如下:

I started to implement a GIT repository following a specific Workflow. The workflow is the following:

                                v0.1               v0.2 
                                 /                  / 
 releases-------------------------------------------------
/                               |                   |
main--------------------------[0.1]---------------[0.2]                   
\                            /    \               /
 development---             /      \             /
               \           /        \           /
                feature-ABC          feature-XYZ

  1. main包含最新的稳定代码,任何开发人员都可以在其中git checkout -> build -> deploy
  2. main包含用于标识release
  3. 标记
  4. 每个发行版都分支到release分支
  5. development是开发人员的开始分支. commit之后,构建服务器将把解决方案构建/部署到development environment
  6. 如果开发人员需要处理故事/功能,则它们会从development分支,并在使用feature/namehotfix/bugname的分支命名后推回到development. li>
  7. development稳定后,将其合并回main,并对该版本进行标记,并进行部署in staging
  8. release
  9. 中创建了发布版本
  1. main contains the latest stable code where any developer can just git checkout -> build -> deploy
  2. main contains tags used to identify a release
  3. Every release version is branched into release branch
  4. development is the starting branch for a developer. After a commit the Build Server will Build/Deploy the solution into a development environment
  5. If a Dev needs to work on a story/feature they branch from development and push back into development when done using a branch naming of feature/name or hotfix/bugname
  6. When development gets stable, it is merged back into main and the release is tagged and get deployed in staging
  7. a Release version is created into release

问题

现在,为了采用此工作流程,我创建了开发人员应执行的GIT commands序列.您可以验证正确性吗?

Questions

Now, in order to adopt this workflow, I created a sequence of GIT commands that a developer should execute. Can you verify the correctness?

此外,我如何确保main和development始终保持正确同步?

Also, how can I ensure that main and development are always properly in sync?

$ git checkout master
$ git branch -b development
$ git push -u origin development

开发开始

$ git checkout development
$ git branch -b feature/my_feature

... iteration ...
 $ git add ...
 $ git commit -m "My Comment"
 $ git push origin feature/my_feature
... iteration ...

开发人员完成了功能/错误

$ git checkout development
$ git merge feature/my_feature
... resolve conflicts ...
$ git commit -m "Merge from feature/my_feature"
$ git push -u origin development

测试程序批准最新的开发版本

$ git checkout master
$ git merge development
... resolve conflicts ...
$ git tag -a v0.1 -m "my version 0.1"
$ git commit -m "Merge from development"
$ git push -u origin master --tags

$ git checkout master
$ git branch v0.1
$ git commit -m "my version 0.1"
$ git push -u origin v0.1

推荐答案

这些命令可以满足您计划使用的工作流程.但是,您可以参考一些细微的东西(也可以将其保持为原始状态):

The commands can meet the work flow you plan to use. But there has some tiny things for you to refer (it's also ok to keep it as original):

1. git push-u仅需要第一次推送(设置为上游).

1.git push with -u only need for first time push (set upstream).

2.发行版本始终存在于release分支中.因此,您可以将main分支合并到release分支中,而不用创建分支v0.1v0.2等.

2.The release versions are always exist in release branch. So you can merge main branch into release branch instead of creating branch v0.1, v0.2 etc.

要检查maindevelopment是否同步,可以使用git log main..development.如果有输出,则意味着development分支的提交需要合并到main分支.

To check if main and development are sync, you can use git log main..development. If it has output, that means the development branch has commit(s) need to merge into main branch.

这篇关于对于我的分支结构,GIT正确的工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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