mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Update switch-branch.ps1
This commit is contained in:
parent
7cbd688374
commit
1bb7b22b27
@ -22,7 +22,7 @@ try {
|
||||
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1/3: Checking requirements..."
|
||||
"⏳ Checking requirements [step 1/3]... "
|
||||
$RepoDir = resolve-path "$RepoDir"
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
@ -34,14 +34,14 @@ 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" }
|
||||
|
||||
"⏳ Step 2/3: Fetching latest updates and switching branch..."
|
||||
"⏳ Fetching latest updates and switching branch [step 2/3]..."
|
||||
& git fetch --all --recurse-submodules --prune --prune-tags --force
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
& git checkout --recurse-submodules "$BranchName"
|
||||
if ($lastExitCode -ne "0") { throw "'git checkout $BranchName' failed" }
|
||||
|
||||
"⏳ Step 3/3: Pulling updates and updating submodules..."
|
||||
"⏳ Pulling updates and updating submodules [step 3/3]..."
|
||||
& git pull --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user