Improve switch-branch.ps1

This commit is contained in:
Markus Fleschutz 2021-04-23 08:56:09 +02:00
parent d01aa17c1f
commit c5bb8480f7

View File

@ -23,15 +23,15 @@ try {
& "$PSScriptRoot/fetch-repo.ps1"
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
& git switch --recurse-submodules "$BranchName"
& git switch "$BranchName"
if ($lastExitCode -ne "0") { throw "'git switch $BranchName' failed" }
& git pull
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
& git submodule update --init --recursive
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
& git pull --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
"✔️ switched Git repository 📂$RepoDir to branch 🌵$BranchName"
exit 0
} catch {