Last active
January 11, 2022 14:19
-
-
Save MrJerB/e4ed4ddcdb86ff51e894bf3da549de7f to your computer and use it in GitHub Desktop.
Create release branch on origin with same name as currently checked out feature branch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Publish-RemoteReleaseBranch { | |
param ([string] $Suffix = $null, [switch] $Copy = $false, [switch] $SetGlobal = $false) | |
$currentBranch = git branch --show-current; | |
if (!$currentBranch.StartsWith("feature/")) { | |
Write-Host "Not a feature branch"; | |
return; | |
} | |
if ($Suffix -and !$Suffix.StartsWith("_")) { | |
$Suffix = "_$Suffix" | |
} | |
$releaseBranchName = "release$($currentBranch.Substring(7))$Suffix"; | |
git push origin origin/master:refs/heads/$releaseBranchName; | |
if ($Copy) { | |
$releaseBranchName | Set-Clipboard; | |
} | |
if ($SetGlobal) { | |
$Global:ReleaseBranchName = $releaseBranchName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment