Skip to content

Add PatchVersionTag

Nick Spreitzer edited this page Nov 16, 2019 · 5 revisions
external help file: GitVersioning-help.xml
Module Name: WhatsNew
schema: 2.0.0

Add-PatchVersionTag

SYNOPSIS

Adds a new patch version tag to the current git repository.

SYNTAX

Add-PatchVersionTag [-Message] <String> [-CurrentBranchOnly] [<CommonParameters>]

DESCRIPTION

Finds the most recent git tag in the current repository that has the form v0.0.0, increments the patch version number according to semantic versioning rules, and adds a new annotated git tag with the updated version number.

EXAMPLES

Example 1

PS C:\> Add-PatchVersionTag -m "Bug fixes ahoy!"

Increments the patch version and appends a new git tag to the HEAD commit.

PARAMETERS

-Message

The message to associate with the new tag.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CurrentBranchOnly

By default, all branches are searched for the most recent version tag which is then used as the basis for the next version. However, -CurrentBranchOnly restricts this search to the the lineage of the current branch. The default is preferable if you want versions to span the entire repository; CurrentBranchOnly is preferrable if you want versions restricted to particular branches.

For example...

Let's say you have a repository with a commit tagged v6.0.0 in one branch and another tagged v5.2.3 in a different branch. Now let's say you need to make a change to the v5.X.X branch that shouldn't be considered part of v6.0.0. In that scenario, you should use Add-PatchVersion -CurrentBranchOnly -Message 'Fixed the thing' to create a new tag v5.2.4. If you didn't specify -CurrentBranchOnly -- regardless of which branch you're currently on -- the next version generated by Add-PatchVersion would be v6.0.1 because it would determine that across all branches v6.0.0 is the most recent version and would use it as the basis for the next version.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS

Add-PatchVersionTag