|
| 1 | +# GitVersion Docs |
| 2 | +GitVersion is a tool to help you achieve Semantic Versioning on your project. |
| 3 | + |
| 4 | +This influences many of the decisions GitVersion has made, please read and understand this page as it will help you start using GitVersion effectively! |
| 5 | + |
| 6 | +## Assumptions/Rules |
| 7 | +### You tag releases when you release, not before |
| 8 | +GitVersion assumes that tags are used to *tag a release* and not used to build a release. |
| 9 | + |
| 10 | +This means that the version is calculated pre-emptively, if you currently tag, build then release that tag then GitVersion will probably not work for you. |
| 11 | + |
| 12 | +### Tags override other rules |
| 13 | +If a commit is tagged, then GitVersion will *always* use that version over any calculated versions. This is so if you rebuild a tag then the same version will be produced. |
| 14 | + |
| 15 | +### The Semantic Version does not increment every commit |
| 16 | +This trips a lot of people up, by default GitVersion *does not* increment the SemVer every commit. This means that you will get multiple builds producing the *same version* of your application. |
| 17 | + |
| 18 | +Read more at [version increments](./versionIncrements.md) |
| 19 | + |
| 20 | +### Version sources |
| 21 | +There are a number of sources GitVersion can get it's versions from, they include: |
| 22 | + |
| 23 | + - Tags |
| 24 | + - Version numbers in branches (i.e `release/2.0.0`) |
| 25 | + - Merge messages (for branches with versions in them, i.e `Merged branch 'release/2.0.0' into master`) |
| 26 | + - Track version of another branch (i.e develop tracks master, so when master increments so does develop) |
| 27 | + - GitVersionConfig.yaml file (i.e `next-version: 2.0.0`) |
| 28 | + |
| 29 | +Read more at [version sources](./versionSources.md) |
| 30 | + |
| 31 | +## Configuration |
| 32 | +GitVersion v3 was rewritten to be very configuration driven rather than hardcoding git workflows into it. This has made it a lot more flexible. Configuration options can be set globally or per branch. |
| 33 | + |
| 34 | +Read more about the different [configuration options](./configurationOptions.md) |
| 35 | + |
| 36 | +## Output Variables |
| 37 | +We recognise that a single formatted version number does not work for all cases. A simple example is NuGet, it doesn't support SemVer 2.0 meaning that the SemVer of `1.3.5-beta.10+500` needs to be formatted as `1.3.5-beta0010` so it will sort properly. |
| 38 | + |
| 39 | +You can just run `GitVersion.exe` in your repository to see what variables are available (by default a json object is returned). |
| 40 | + |
| 41 | +## Exe or MSBuild Task |
| 42 | +There are two ways to consume GitVersion, the first is by running GitVersion.exe. The second is an MSBUild task. The MSBuild task is really easy to get up and running, simply install GitVersionTask from NuGet and it will integrate into your project and write out variables to your build server if it's running on one. The exe offers more options and works for not just .net projects. |
| 43 | + |
| 44 | +Read more about [using GitVersion](./usage.md) |
0 commit comments