mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-27 12:18:43 +02:00
Updated switch-branch.ps1
This commit is contained in:
parent
7f08428442
commit
6f6886f88d
@ -12,10 +12,10 @@
|
||||
⏳ (1/6) Searching for Git executable... git version 2.43.0.windows.1
|
||||
⏳ (2/6) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/6) Fetching remote updates...
|
||||
⏳ (4/6) Switching to branch 'main'...
|
||||
⏳ (4/6) Switching to 'main' branch...
|
||||
⏳ (5/6) Pulling remote updates...
|
||||
⏳ (6/6) Updating submodules...
|
||||
✅ Repo 📂rust switched to 'main' branch in 22s.
|
||||
✅ Switched repo 📂rust to 'main' branch in 22s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,7 +47,7 @@ try {
|
||||
& git -C "$pathToRepo" fetch --all --prune --prune-tags --force
|
||||
if ($lastExitCode -ne 0) { throw "'git fetch' failed with exit code $lastExitCode" }
|
||||
|
||||
"⏳ (4/6) Switching to branch '$branchName'..."
|
||||
"⏳ (4/6) Switching to '$branchName' branch..."
|
||||
& git -C "$pathToRepo" checkout --recurse-submodules "$branchName"
|
||||
if ($lastExitCode -ne 0) { throw "'git checkout $branchName' failed with exit code $lastExitCode" }
|
||||
|
||||
@ -60,7 +60,7 @@ try {
|
||||
if ($lastExitCode -ne 0) { throw "'git submodule update' failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✅ Repo 📂$repoDirName switched to '$branchName' branch in $($elapsed)s."
|
||||
"✅ Switched repo 📂$repoDirName to '$branchName' branch in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)"
|
||||
|
Loading…
Reference in New Issue
Block a user