Skip to content

Instantly share code, notes, and snippets.

@MertSenel
Created May 23, 2020 08:23
Generate a feature branch name that takes AzureDevOps Work Item Version and Title Format as arguements and optionally your the developer's initials
function New-FeatureBranchName {
[CmdletBinding()]
param (
# Work Item ID
[Parameter(Mandatory)][Alias('i','id')][string]$workItemId,
# Work Item Title
[Parameter(Mandatory)][Alias('t','title')][string]$workItemTitle,
# Initials
[Parameter()][Alias('in','name', 'inits')][string]$initials
)
$featureprefix = "feature/"
if($initials) {$featureprefix = $featureprefix + $initials + '/'}
$TitleFormatted = $workItemTitle -replace " ", "_"
$branchname = $featureprefix + $workItemId + '_' + $TitleFormatted
return $branchname
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment