mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-22 09:58:19 +02:00
Update switch-branch.ps1
This commit is contained in:
parent
92dbf75dae
commit
f9e7237647
@ -29,7 +29,7 @@ try {
|
|||||||
|
|
||||||
$RepoDir = Resolve-Path "$RepoDir"
|
$RepoDir = Resolve-Path "$RepoDir"
|
||||||
$RepoDirName = (Get-Item "$RepoDir").Name
|
$RepoDirName = (Get-Item "$RepoDir").Name
|
||||||
"⏳ Step 2/6 - Checking folder 📂$RepoDirName..."
|
"⏳ Step 2/6 - Checking Git repository 📂$RepoDirName..."
|
||||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
|
||||||
$Result = (git status)
|
$Result = (git status)
|
||||||
@ -53,7 +53,7 @@ try {
|
|||||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ switched Git repo 📂$RepoDirName to $BranchName branch in $Elapsed sec"
|
"✔️ switched 📂$RepoDirName repo to $BranchName branch in $Elapsed sec"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user