问题描述
我按照特定的工作流程开始实施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
-
main
包含最新的稳定代码,任何开发人员都可以在其中git checkout -> build -> deploy
-
main
包含用于标识release
的标记 - 每个发行版都分支到
release
分支 -
development
是开发人员的开始分支.commit
之后,构建服务器将把解决方案构建/部署到development environment
- 如果开发人员需要处理故事/功能,则它们会从
development
分支,并在使用feature/name
或hotfix/bugname
的分支命名后推回到development
. li> -
development
稳定后,将其合并回main
,并对该版本进行标记,并进行部署in staging
- 在
release
中创建了发布版本
main
contains the latest stable code where any developer can justgit checkout -> build -> deploy
main
contains tags used to identify arelease
- Every release version is branched into
release
branch development
is the starting branch for a developer. After acommit
the Build Server will Build/Deploy the solution into adevelopment environment
- If a Dev needs to work on a story/feature they branch from
development
and push back intodevelopment
when done using a branch naming offeature/name
orhotfix/bugname
- When
development
gets stable, it is merged back intomain
and the release is tagged and get deployedin staging
- 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.1
,v0.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.
要检查main
和development
是否同步,可以使用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正确的工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!