-
-
- -

Open-Source

-

- GitVersion is free to use, improve, contribute and distribute. - Source code is available on GitHub under MIT license. -

+
+
+
+

GitVersion

+

From git log to SemVer in no time

+

Semantic versioning powered by your Git history.
Automate version numbers across your builds and releases.

+
+
+ +
+ + + + +
+ +
+
+

Getting Started

+
+

Installation

Install GitVersion as a global .NET tool.

+
@(Context.String("DocsRelease") == "development" ? "git clone https://github.com/GitTools/GitVersion.git" : "dotnet tool install --global GitVersion.Tool --version " + Context.String("DocsRelease"))
+ @if (Context.String("DocsRelease") == "development") {

This edition follows development source. After cloning, follow the source-build instructions to run v7.

} +

Also available for Docker and MSBuild.

+ Full installation guide → +
+

Usage

Run it inside your Git repository.

+
# Calculate your version
+dotnet-gitversion
 
-        
- -

Flexible

-

- GitVersion is built for many different use-cases and workflows, so whether you use - Mainline, - Git Flow or - GitHub Flow, - GitVersion has you covered. -

+# Print a single version variable +dotnet-gitversion @(new Version(Context.String("DocsEdition")).Major >= 7 ? "--show-variable" : "/showvariable") SemVer
+ Command-line options → +
+
-
+ -
-
- -

Configurable

-

- Gitversion is highly configurable - and can be made to support your specific versioning scheme, almost - regardless of what it may be. -

+
+

How It Works

+
+

Version Calculation Example

GitVersion reads your tags, branches, and commits to calculate a semantic version for the current commit.

Your history is the starting point

  • Tags establish released versions.
  • Branches provide context for your workflow.
  • Configuration controls increments and pre-release labels.

This example is illustrative. Your output depends on your repository history and configuration.

Learn how versions are calculated →
+
+
A HISTORY WORTH BUILDING ON
+ + A feature branch merges back into main + Commits on main and a feature branch form the history GitVersion reads. The version below is illustrative; actual output depends on your history and configuration. + + + + + + v1.0.0feature / nextmain + +
+
gitversionILLUSTRATIVE OUTPUT
+
1.1.0
+
"FullSemVer": "1.1.0" Ready to build
+
+
Git historyGitVersionSemantic version
+
+
-
- -

Rich tooling

-

- Expose version variables in different formats to the tools you use. Use GitVersion locally or in a - build pipeline with - TeamCity, - AppVeyor, - Jenkins or any of the other supported - build servers. -

+
+
+ +

Need Help?

Ask the community, report an issue, or help improve GitVersion.

+