mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 14:18:38 +01: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 ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Git repository is NOT clean: $Result" }
|
||||
|
||||
& "$PSScriptRoot/fetch-repo.ps1"
|
||||
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
"🢃 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"
|
||||
if ($lastExitCode -ne "0") { throw "'git switch $BranchName' failed" }
|
||||
@ -32,7 +35,7 @@ try {
|
||||
& git submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||
|
||||
"✔️ switched Git repository 📂$RepoDir to branch 🌵$BranchName"
|
||||
"✔️ switched to branch '$BranchName'"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user