@@ -5,13 +5,13 @@ Description: Details about how GitVersion can be configured to suit your needs
5
5
RedirectFrom : docs/configuration
6
6
---
7
7
8
- GitVersion from version 3 is mainly powered by configuration and no longer has
9
- branching strategies hard coded.
8
+ GitVersion, starting from version 3.0, is mainly powered by configuration and no
9
+ longer has branching strategies hard- coded.
10
10
11
11
## Configuration tool
12
12
13
- If you run ` gitversion init ` you will be launched into a configuration tool, it
14
- can help you configure GitVersion the way you want it.
13
+ If you run ` gitversion init ` , GitVersion will launch into a configuration tool,
14
+ which can help you configure GitVersion the way you want it.
15
15
16
16
Once complete, the ` init ` command will create a ` GitVersion.yml ` file in the
17
17
working directory. It can be the root repository directory or any subdirectory
@@ -28,21 +28,21 @@ GitHubFlow and GitFlow, probably with others too.
28
28
The ` develop ` branch is set to ` ContinuousDeployment ` mode by default as we have
29
29
found that is generally what is needed when using GitFlow.
30
30
31
- You can run ` GitVersion /showConfig ` to see the effective configuration
32
- (defaults + overrides) .
31
+ To see the effective configuration (defaults and overrides), you can run
32
+ ` gitversion /showConfig ` .
33
33
34
- To create your config file just type ` GitVersion init` in your repo directory
35
- after installing via chocolatey and a minimal ` GitVersion.yml ` configuration
36
- file will be created. Modify this as you need .
34
+ To create your config file just type ` gitversion init` in your repo directory,
35
+ after [ installing] . A minimal ` GitVersion.yml ` configuration file will be
36
+ created. Modify this to suit your needs .
37
37
38
38
## Global configuration
39
39
40
- The global configuration look like this:
40
+ The global configuration looks like this:
41
41
42
42
``` yaml
43
43
next-version : 1.0
44
44
assembly-versioning-scheme : MajorMinorPatch
45
- assembly-file-versioning-scheme : MajorMinorPatchTag
45
+ assembly-file-versioning-scheme : MajorMinorPatch
46
46
assembly-informational-format : ' {InformationalVersion}'
47
47
mode : ContinuousDelivery
48
48
increment : Inherit
@@ -55,20 +55,21 @@ no-bump-message: '\+semver:\s?(none|skip)'
55
55
legacy-semver-padding : 4
56
56
build-metadata-padding : 4
57
57
commits-since-version-source-padding : 4
58
+ tag-pre-release-weight : 60000
58
59
commit-message-incrementing : Enabled
59
- commit-date-format : ' yyyy-MM-dd'
60
60
ignore :
61
61
sha : []
62
62
commits-before : yyyy-MM-ddTHH:mm:ss
63
63
merge-message-formats : {}
64
+ update-build-number : true
64
65
` ` `
65
66
66
- And the description of the available options are:
67
+ The details of the available options are as follows :
67
68
68
69
### next-version
69
70
70
71
Allows you to bump the next version explicitly, useful for bumping ` main` or a
71
- feature with breaking changes a major increment.
72
+ feature with breaking changes (i.e., a major increment) .
72
73
73
74
# ## assembly-versioning-scheme
74
75
@@ -142,7 +143,8 @@ branches which do not have one specified. Default set to `ci`.
142
143
143
144
Just to clarify : For a build name without `...-ci-<buildnumber>` or in other
144
145
words without a `PreReleaseTag` (ergo `"PreReleaseTag":""` in GitVersion's JSON output)
145
- at the end you would need to set `continuous-delivery-fallback-tag` to an empty string (`''`) :
146
+ at the end you would need to set `continuous-delivery-fallback-tag` to an empty
147
+ string (`''`) :
146
148
147
149
` ` ` yaml
148
150
mode: ContinuousDeployment
@@ -154,9 +156,9 @@ Doing so can be helpful if you use your `main` branch as a `release` branch.
154
156
155
157
# ## tag-prefix
156
158
157
- A regex which is used to trim git tags before processing (eg v1.0.0). Default is
158
- ` [vV]` though this is just for illustrative purposes as we do a IgnoreCase match
159
- and could be `v`.
159
+ A regex which is used to trim Git tags before processing (e.g., v1.0.0). Default
160
+ is `[vV]`, although this is just for illustrative purposes as we do a IgnoreCase
161
+ match and could be `v`.
160
162
161
163
# ## major-version-bump-message
162
164
@@ -185,29 +187,29 @@ none` and `+semver: skip`
185
187
# ## legacy-semver-padding
186
188
187
189
The number of characters to pad `LegacySemVer` to in the `LegacySemVerPadded`
188
- [variable][variables]. Is default set to `4`, which will pad the
189
- ` LegacySemVer ` value of `3.0.0-beta1` to `3.0.0-beta0001`.
190
+ [variable][variables]. Default is `4`, which will pad the `LegacySemVer` value
191
+ of `3.0.0-beta1` to `3.0.0-beta0001`.
190
192
191
193
# ## build-metadata-padding
192
194
193
195
The number of characters to pad `BuildMetaData` to in the `BuildMetaDataPadded`
194
- [variable][variables]. Is default set to `4`, which will pad the
195
- ` BuildMetaData ` value of `1` to `0001`.
196
+ [variable][variables]. Default is `4`, which will pad the `BuildMetaData` value
197
+ of `1` to `0001`.
196
198
197
199
# ## commits-since-version-source-padding
198
200
199
201
The number of characters to pad `CommitsSinceVersionSource` to in the
200
- ` CommitsSinceVersionSourcePadded` [variable][variables]. Is default set to `4`,
201
- which will pad the `CommitsSinceVersionSource` value of `1` to `0001`.
202
+ ` CommitsSinceVersionSourcePadded` [variable][variables]. Default is `4`, which
203
+ will pad the `CommitsSinceVersionSource` value of `1` to `0001`.
202
204
203
205
# ## tag-pre-release-weight
204
206
205
207
The pre-release weight in case of tagged commits. If the value is not set in the
206
208
configuration, a default weight of 60000 is used instead. If the
207
- ` WeightedPreReleaseNumber` [variable][variables] is 0 and this
208
- parameter is set, its value is used. This helps if your branching model is
209
- GitFlow and the last release build, which is often tagged, can utilise this
210
- parameter to produce a monotonically increasing build number.
209
+ ` WeightedPreReleaseNumber` [variable][variables] is 0 and this parameter is set,
210
+ its value is used. This helps if your branching model is GitFlow and the last
211
+ release build, which is often tagged, can utilise this parameter to produce a
212
+ monotonically increasing build number.
211
213
212
214
# ## commit-message-incrementing
213
215
@@ -255,10 +257,6 @@ Date and time in the format `yyyy-MM-ddTHH:mm:ss` (eg `commits-before:
255
257
2015-10-23T12:23:15`) to setup an exclusion range. Effectively any commit before
256
258
` commits-before` will be ignored.
257
259
258
- # ## update-build-number
259
-
260
- Configures GitVersion to update the build number or not when running on a build server.
261
-
262
260
# ## merge-message-formats
263
261
264
262
Custom merge message formats to enable identification of merge messages that do not
@@ -273,12 +271,16 @@ merge-message-formats:
273
271
274
272
The regular expression should contain the following capture groups :
275
273
276
- * SourceBranch - Identifies the source branch of the merge
277
- * TargetBranch - Identifies the target of the merge
278
- * PullRequestNumber - Captures the pull-request number
274
+ * ` SourceBranch` - Identifies the source branch of the merge
275
+ * ` TargetBranch` - Identifies the target branch of the merge
276
+ * ` PullRequestNumber` - Captures the pull-request number
279
277
280
278
Custom merge message formats are evaluated _before_ any built in formats.
281
279
280
+ # ## update-build-number
281
+
282
+ Configures GitVersion to update the build number or not when running on a build server.
283
+
282
284
# # Branch configuration
283
285
284
286
Then we have branch specific configuration, which looks something like this :
@@ -301,27 +303,47 @@ branches:
301
303
increment: Patch
302
304
prevent-increment-of-merged-branch-version: true
303
305
track-merge-target: false
306
+ source-branches: [ 'develop', 'release' ]
304
307
tracks-release-branches: false
305
308
is-release-branch: false
309
+ is-mainline: true
310
+ pre-release-weight: 55000
311
+ develop:
312
+ regex: ^dev(elop)?(ment)?$
313
+ mode: ContinuousDeployment
314
+ tag: alpha
315
+ increment: Minor
316
+ prevent-increment-of-merged-branch-version: false
317
+ track-merge-target: true
318
+ source-branches: []
319
+ tracks-release-branches: true
320
+ is-release-branch: false
321
+ is-mainline: false
322
+ pre-release-weight: 0
306
323
release:
307
324
regex: ^releases?[/-]
308
325
mode: ContinuousDelivery
309
326
tag: beta
310
- increment: Patch
327
+ increment: None
311
328
prevent-increment-of-merged-branch-version: true
312
329
track-merge-target: false
330
+ source-branches: [ 'develop', 'main', 'support', 'release' ]
313
331
tracks-release-branches: false
314
332
is-release-branch: true
315
- pre-release-weight: 1000
333
+ is-mainline: false
334
+ pre-release-weight: 30000
316
335
feature:
317
336
regex: ^features?[/-]
318
337
mode: ContinuousDelivery
319
338
tag: useBranchName
320
339
increment: Inherit
321
340
prevent-increment-of-merged-branch-version: false
322
341
track-merge-target: false
342
+ source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ]
323
343
tracks-release-branches: false
324
344
is-release-branch: false
345
+ is-mainline: false
346
+ pre-release-weight: 30000
325
347
pull-request:
326
348
regex: ^(pull|pull\- requests|pr)[/-]
327
349
mode: ContinuousDelivery
@@ -330,39 +352,39 @@ branches:
330
352
prevent-increment-of-merged-branch-version: false
331
353
tag-number-pattern: '[/-](?<number>\d +)[-/]'
332
354
track-merge-target: false
355
+ source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ]
333
356
tracks-release-branches: false
334
357
is-release-branch: false
358
+ is-mainline: false
359
+ pre-release-weight: 30000
335
360
hotfix:
336
361
regex: ^hotfix(es)?[/-]
337
362
mode: ContinuousDelivery
338
363
tag: beta
339
364
increment: Patch
340
365
prevent-increment-of-merged-branch-version: false
341
366
track-merge-target: false
367
+ source-branches: [ 'develop', 'main', 'support' ]
342
368
tracks-release-branches: false
343
369
is-release-branch: false
370
+ is-mainline: false
371
+ pre-release-weight: 30000
344
372
support:
345
373
regex: ^support[/-]
346
374
mode: ContinuousDelivery
347
375
tag: ''
348
376
increment: Patch
349
377
prevent-increment-of-merged-branch-version: true
350
378
track-merge-target: false
379
+ source-branches: [ 'main' ]
351
380
tracks-release-branches: false
352
381
is-release-branch: false
353
- develop:
354
- regex: ^dev(elop)?(ment)?$
355
- mode: ContinuousDeployment
356
- tag: unstable
357
- increment: Minor
358
- prevent-increment-of-merged-branch-version: false
359
- track-merge-target: true
360
- tracks-release-branches: true
361
- is-release-branch: false
382
+ is-mainline: true
383
+ pre-release-weight: 55000
362
384
` ` `
363
385
364
- If you don't specify the regex the inbuilt for that branch config will be used
365
- (recommended)
386
+ If you don't specify the regex, the built-in for that branch config will be
387
+ used (recommended).
366
388
367
389
We don't envision many people needing to change most of these configuration
368
390
values, but here they are if you need to :
@@ -374,13 +396,13 @@ branch configuration.
374
396
375
397
# ## source-branches
376
398
377
- Because git commits only refer to parent commits (not branches) GitVersion
399
+ Because Git commits only refer to parent commits (not branches) GitVersion
378
400
sometimes cannot tell which branch the current branch was branched from.
379
401
380
402
Take this commit graph
381
403
382
404
` ` ` shell
383
- * release/1 .0.0 * feature/foo
405
+ * release/v1 .0.0 * feature/foo
384
406
| ________________/
385
407
|/
386
408
*
@@ -390,19 +412,19 @@ Take this commit graph
390
412
391
413
By looking at this graph, you cannot tell which of these scenarios happened :
392
414
393
- * feature/foo branches off release/1 .0.0
394
- * Branch release/1 .0.0 from main
395
- * Branch feature/foo from release/1 .0.0
396
- * Add a commit to both release/1 .0.0 and feature/foo
397
- * release/1 .0.0 is the base for feature/foo
398
- * release/1 .0.0 branches off feature/foo
399
- * Branch feature/foo from main
400
- * Branch release/1 .0.0 from feature/foo
401
- * Add a commit to both release/1 .0.0 and feature/foo
402
- * feature/foo is the base for release/1 .0.0
415
+ * feature/foo branches off release/v1 .0.0
416
+ * Branch release/v1 .0.0 from main
417
+ * Branch feature/foo from release/v1 .0.0
418
+ * Add a commit to both release/v1 .0.0 and feature/foo
419
+ * release/v1 .0.0 is the base for feature/foo
420
+ * release/v1 .0.0 branches off feature/foo
421
+ * Branch feature/foo from main
422
+ * Branch release/v1 .0.0 from feature/foo
423
+ * Add a commit to both release/v1 .0.0 and feature/foo
424
+ * feature/foo is the base for release/v1 .0.0
403
425
404
426
Or put more simply, you cannot tell which branch was created first,
405
- ` release/1 .0.0` or `feature/foo`.
427
+ ` release/v1 .0.0` or `feature/foo`.
406
428
407
429
To resolve this issue, we give GitVersion a hint about our branching workflows
408
430
by telling it what types of branches a branch can be created from. For example,
@@ -509,7 +531,7 @@ branches:
509
531
510
532
Strategy which will look for tagged merge commits directly off the current
511
533
branch. For example `develop` → `release/1.0.0` → merge into `main` and tag
512
- ` 1.0.0` . The tag is _not_ on develop, but develop should be version `1.0.0` now.
534
+ ` 1.0.0` . The tag is *not* on develop, but develop should be version `1.0.0` now.
513
535
514
536
# ## tracks-release-branches
515
537
@@ -522,7 +544,7 @@ Indicates this branch config represents a release branch in GitFlow.
522
544
# ## is-mainline
523
545
524
546
When using Mainline mode, this indicates that this branch is a mainline. By
525
- default support/ and main are mainlines.
547
+ default `main` and `support/*` are mainlines.
526
548
527
549
# ## pre-release-weight
528
550
@@ -535,12 +557,13 @@ same file version: "1.2.3.4". One of the ways to use this value is to set
535
557
{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}`. If the `pre-release-weight`
536
558
is set, it would be added to the `PreReleaseNumber` to get a final
537
559
` AssemblySemFileVer` , otherwise a branch specific default for
538
- ` pre-release-weight` will be used in the calculation. Related Issues [1145],
539
- [1366]
560
+ ` pre-release-weight` will be used in the calculation. Related Issues [1145]
561
+ and [1366].
540
562
541
563
[1145] : https://github.com/GitTools/GitVersion/issues/1145
542
564
[1366] : https://github.com/GitTools/GitVersion/issues/1366
543
565
[2506] : https://github.com/GitTools/GitVersion/pull/2506#issuecomment-754754037
566
+ [installing] : /docs/usage/cli/installation
544
567
[modes] : /docs/reference/modes
545
568
[variables] : /docs/reference/variables
546
569
[version-sources] : /docs/reference/version-sources
0 commit comments