Improve create-branch.ps1

This commit is contained in:
Markus Fleschutz 2021-03-31 16:25:46 +02:00
parent b1c3295c48
commit f02f1e726b

View File

@ -19,6 +19,13 @@ try {
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$Result = (git status)
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
& git fetch --all --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" }
& git checkout -b "$NewBranchName"
if ($lastExitCode -ne "0") { throw "'git checkout -b $NewBranchName' failed" }