mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-23 10:28:23 +02:00
Improve output of switch-branch.ps1
This commit is contained in:
parent
0d1a992341
commit
a5a73c929b
@ -20,8 +20,11 @@ try {
|
|||||||
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
||||||
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Git repository is NOT clean: $Result" }
|
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Git repository is NOT clean: $Result" }
|
||||||
|
|
||||||
& "$PSScriptRoot/fetch-repo.ps1"
|
$RepoDirName = (get-item "$RepoDir").Name
|
||||||
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
"🢃 Fetching updates for Git repository 📂$RepoDirName ..."
|
||||||
|
|
||||||
|
& git fetch --all --recurse-submodules --jobs=4
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git fetch -all --recurse-submodules' failed" }
|
||||||
|
|
||||||
& git switch "$BranchName"
|
& git switch "$BranchName"
|
||||||
if ($lastExitCode -ne "0") { throw "'git switch $BranchName' failed" }
|
if ($lastExitCode -ne "0") { throw "'git switch $BranchName' failed" }
|
||||||
@ -32,7 +35,7 @@ try {
|
|||||||
& git submodule update --init --recursive
|
& git submodule update --init --recursive
|
||||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||||
|
|
||||||
"✔️ switched Git repository 📂$RepoDir to branch 🌵$BranchName"
|
"✔️ switched to branch '$BranchName'"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user