Skip to content

Commit 56b6164

Browse files
authored
Merge pull request #4044 from HHobeck/feature/document-git-flow-workflow
Documenting the git flow workflow and create sequence diagrams
2 parents 7b06726 + 7551cad commit 56b6164

18 files changed

+305
-61
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/input/docs/learn/branching-strategies/gitflow/examples.md

Lines changed: 85 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,97 @@ RedirectFrom:
66
- docs/git-branching-strategies/gitflow-examples
77
---
88

9-
These examples are using the _default_ configuration with GitVersion. Which is
10-
[continuous deployment](/docs/reference/modes/continuous-deployment) mode for
11-
`develop` and [continuous delivery](/docs/reference/modes/continuous-delivery) mode
12-
for all other branches.
13-
14-
This default configuration allows you to publish CI builds from develop to a CI
15-
MyGet feed, or another CI feed. Then all other branches are manually released
16-
then tagged. Read more about this at [version increments](/docs/reference/version-increments).
9+
These examples are illustrating the usage of the supported `GitFlow` workflow
10+
in GitVersion. To enable this workflow, the builtin template
11+
[GitFlow/v1](/docs/workflows/GitFlow/v1.json) needs to be referenced in the
12+
configuration as follows:
13+
```yaml
14+
workflow: GitFlow/v1
15+
mode: ContinuousDelivery
16+
```
17+
18+
Where
19+
the [continuous deployment][continuous-deployment] mode for no branches,
20+
the [continuous delivery][continuous-delivery] mode for
21+
`main`, `support` and `develop` branches and
22+
the [manual deployment][manual-deployment] mode
23+
for `release`, `feature`, `hotfix` and `unknown` branches are specified.
24+
25+
This configuration allows you to publish CI (Continuous Integration) builds
26+
from `main`, `support` and `develop` branches to an artifact repository.
27+
All other branches are manually published. Read more about this at
28+
[version increments](/docs/reference/version-increments).
29+
30+
:::{.alert .alert-info}
31+
The _continuous delivery_ mode has been used for the `main` and the
32+
`support` branch in this examples (specified as a fallback on the root
33+
configuration layer) to illustrate how the version increments are applied.
34+
In production context the _continuous deployment_ mode might be a better
35+
option when e.g. the release process is automated or the commits are tagged
36+
by the pipeline automatically.
37+
:::
1738

1839
## Feature Branches
1940

20-
Feature branches will take the feature branch name and use that as the
21-
pre-release tag.
41+
Feature branches can be used in the `GitFlow` workflow to implement a
42+
feature in an isolated environment. Feature branches will take the feature
43+
branch name and use that as the pre-release label. Feature branches will be
44+
created from a `develop`, `release`, `main`, `support` or `hotfix` branch.
2245

23-
![GitFlow](/docs/img/05119d0cd4ecaaefff94\_feature-branch.png)
46+
### Create feature branch from main
2447

25-
Notice after the feature branch is merged, the version on `develop` is
26-
`1.3.0-alpha.3`. This is due to `develop` running in _continuous deployment_
27-
mode. If you configured `develop` to use _continuous delivery_ the version would
28-
still be `1.3.0-alpha.1` and you would have to use release tags to increment the
29-
`alpha.1`.
48+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_FeatureFromMainBranch.png)
3049

31-
You can see the difference on the feature branch itself, notice the version is
32-
the same before and after the commit on the feature branch? Only the metadata
33-
has changed. If you released the feature branch artifacts then tagged the
34-
commit, the following commit would increase to `-beta.2`.
50+
:::{.alert .alert-info}
51+
After the feature branch is merged, the version on `main` is `2.0.0-5`.
52+
This is due to `main` running in _continuous delivery_ mode. If `main` was
53+
configured to use _continuous deployment_ the version would be `2.0.0`.
54+
:::
3555

36-
## Pull Request
56+
### Create feature branch from develop
3757

38-
Because feature branches are most likely pushed to a fork, we are showing the
39-
pull request branch name which is created when you submit a pull request
58+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_FeatureFromDevelopBranch.png)
4059

41-
![GitFlow](/docs/img/09fdf46995b771f3164a_pull-request.png)
60+
:::{.alert .alert-info}
61+
After the feature branch is merged, the version on `develop` is
62+
`1.3.0-alpha.3`. This is due to `develop` running in _continuous delivery_
63+
mode. If `develop` was configured to use _manual deployment_ the version
64+
would still be `1.3.0-alpha.1` and you would have to use pre-release tags
65+
to increment the pre-release label `alpha.1`.
66+
:::
4267

4368
## Hotfix Branches
4469

45-
Hotfix branches are used when you need to do a _patch_ release in GitFlow and
46-
are always created off `main`
70+
Hotfix branches are used when you need to do a _patch_ release in the
71+
`GitFlow` workflow and are always created from `main` branch.
72+
73+
### Create hotfix branch
74+
75+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_HotfixBranch.png)
76+
77+
### Create hotfix branch with version number
78+
79+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_VersionedHotfixBranch.png)
4780

48-
![GitFlow](/docs/img/f26ae57adbd9b74f74c4\_hotfix.png)
81+
## Release Branches
4982

50-
## Minor Release Branches
83+
Release branches are used for major and minor releases to stabilize a RC
84+
(Release Candidate) or to integrate features (in parallel) targeting different
85+
iterations. Release branches are taken from `main` (or from `develop`) and will
86+
be merged back afterwards. Finally the `main` branch is tagged with the
87+
released version.
5188

52-
Release branches are used for both major and minor releases for stabilisation
53-
before a release. Release branches are taken off `develop` then merged to both
54-
`develop` and `main`. Finally `main` is tagged with the released version.
89+
### Create release branch
5590

56-
![GitFlow](/docs/img/6d33d35a70a777608fa1\_minor-release.png)
91+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_ReleaseBranch.png)
5792

58-
## Major Release Branches
93+
### Create release branch with version
5994

60-
Major releases are just like minor releases, the difference is you bump the
61-
major in the release branch name.
95+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_VersionedReleaseBranch.png)
6296

63-
![GitFlow](/docs/img/39f9d8b8b007c82f1f80\_major-release.png)
97+
## Develop Branch
98+
99+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_DevelopBranch.png)
64100

65101
## Support Branches
66102

@@ -71,23 +107,24 @@ majors, then name your branch `support/<major>.x` (i.e `support/1.x`), to
71107
support minors use `support/<major>.<minor>.x` or `support/<major>.<minor>.0`.
72108
(i.e `support/1.3.x` or `support/1.3.0`)
73109

74-
### Hotfix
75-
76-
Depending on what you name your support branch, you may or may not need a hotfix
77-
branch. Naming it `support/1.x` will automatically bump the patch, if you name
78-
it `support/1.3.0` then the version in branch name rule will kick in and the
79-
patch _will not_ automatically bump, meaning you have to use hotfix branches.
80-
![GitFlow](/docs/img/b035b8ca99bd34239518\_support-hotfix.png)
110+
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_SupportBranch.png)
81111

82-
### Minor Release
83-
84-
![GitFlow](/docs/img/2167fb1c4a5cf84edfd8\_support-minor.png)
112+
:::{.alert .alert-info}
113+
Depending on what you name your support branch, you may or may not need a
114+
hotfix branch. Naming it `support/1.x` will automatically bump the patch,
115+
if you name it `support/1.3.0` then the version in branch name rule will
116+
kick in and the patch _will not_ automatically bump, meaning you have to
117+
use hotfix branches.
118+
:::
85119

86120
## To Contribute
87121

88122
See [contributing examples](/docs/learn/branching-strategies/contribute-examples).
89123

90124
### Source
91125

92-
See `DocumentationSamples.GitFlowExample`. To update, modify then run test.
93-
Update <https://gist.github.com/JakeGinnivan/cf053d7f5d336ae9f7bb>
126+
See `DocumentationSamplesForGitFlow.cs`. To update, modify then run test.
127+
128+
[continuous-deployment]: /docs/reference/modes/continuous-deployment
129+
[continuous-delivery]: /docs/reference/modes/continuous-delivery
130+
[manual-deployment]: /docs/reference/modes/manual-deployment

docs/input/docs/reference/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ strategies:
7070
- VersionInBranchName
7171
branches:
7272
develop:
73+
mode: ContinuousDelivery
7374
label: alpha
7475
increment: Minor
7576
prevent-increment:

0 commit comments

Comments
 (0)