mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-09 18:14:36 +02:00
Updated clean-repo.ps1 and switch-branch.ps1
This commit is contained in:
parent
f5828c0012
commit
b702577042
@ -12,7 +12,7 @@
|
||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (4/4) Removing untracked files in submodules...
|
||||
✅ Cleaned the 📂rust repository in 2s.
|
||||
✅ Repo 📂rust is clean now.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -22,8 +22,6 @@
|
||||
param([string]$path = "$PWD")
|
||||
|
||||
try {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
|
||||
& git --version
|
||||
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
@ -44,8 +42,7 @@ try {
|
||||
& git -C "$path" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
|
||||
if ($lastExitCode -ne 0) { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✅ Cleaned the 📂$repoName repository in $($elapsed)s."
|
||||
"✅ Repo 📂$repoName is clean now."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -15,7 +15,7 @@
|
||||
⏳ (4/6) Switching to branch 'main'...
|
||||
⏳ (5/6) Pulling remote updates...
|
||||
⏳ (6/6) Updating submodules...
|
||||
✅ Switched 📂rust repo to 'main' branch in 22s.
|
||||
✅ Repo 📂rust switched to 'main' branch in 22s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -60,9 +60,9 @@ try {
|
||||
if ($lastExitCode -ne 0) { throw "'git submodule update' failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✅ Switched 📂$repoDirName repo to '$branchName' branch in $($elapsed)s."
|
||||
"✅ Repo 📂$repoDirName switched to '$branchName' branch in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user