Skip to content

Instantly share code, notes, and snippets.

@MertSenel
Created May 23, 2020 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MertSenel/1bf3b01ecbddd9b9966a7663603a1dab to your computer and use it in GitHub Desktop.
Save MertSenel/1bf3b01ecbddd9b9966a7663603a1dab to your computer and use it in GitHub Desktop.
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