mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Updaate switch-branch.ps1
This commit is contained in:
parent
d5dcca6f3a
commit
ccfa0bdc20
@ -27,8 +27,9 @@ try {
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
"⏳ Step 2/6 - Checking Git repository..."
|
||||
$RepoDir = Resolve-Path "$RepoDir"
|
||||
$RepoDirName = (Get-Item "$RepoDir").Name
|
||||
"⏳ Step 2/6 - Checking folder 📂$RepoDirName..."
|
||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
|
||||
$Result = (git status)
|
||||
@ -51,9 +52,8 @@ try {
|
||||
& git -C "$RepoDir" submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
|
||||
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ switched 📂$RepoDirName repo to '$BranchName' branch in $Elapsed sec"
|
||||
"✔️ switched Git repo 📂$RepoDirName to $BranchName branch in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user