From f02f1e726b93b0a87ba4a2f48d638222065d37c0 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 31 Mar 2021 16:25:46 +0200 Subject: [PATCH] Improve create-branch.ps1 --- Scripts/create-branch.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Scripts/create-branch.ps1 b/Scripts/create-branch.ps1 index 12ed9ceb..76683d6f 100755 --- a/Scripts/create-branch.ps1 +++ b/Scripts/create-branch.ps1 @@ -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" }