Update pull-repo.ps1

This commit is contained in:
Markus Fleschutz 2023-03-28 08:33:54 +02:00
parent 4fadebf14a
commit 035bafb668

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Pulls repository updates Pulls Git repo updates
.DESCRIPTION .DESCRIPTION
This PowerShell script pulls updates for a local Git repository (including submodules). This PowerShell script pulls updates into a local Git repository (including submodules).
.PARAMETER RepoDir .PARAMETER RepoDir
Specifies the file path to the local Git repository (default is working directory) Specifies the file path to the local Git repository (default is working directory)
.EXAMPLE .EXAMPLE
@ -29,7 +29,7 @@ try {
$Result = (git -C "$RepoDir" status) $Result = (git -C "$RepoDir" status)
if ("$Result" -match "HEAD detached at ") { throw "Currently in detached HEAD state (not on a branch!), so nothing to pull" } if ("$Result" -match "HEAD detached at ") { throw "Currently in detached HEAD state (not on a branch!), so nothing to pull" }
Write-Host "⏳ (3/4) Pulling updates... " -noNewline Write-Host "⏳ (3/4) Pulling latest updates..."
& git -C "$RepoDir" pull --recurse-submodules=yes & git -C "$RepoDir" pull --recurse-submodules=yes
if ($lastExitCode -ne "0") { throw "'git pull' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git pull' failed with exit code $lastExitCode" }