Update fetch-repo.ps1 and pull-repo.ps1

This commit is contained in:
Markus Fleschutz
2023-04-19 08:28:30 +02:00
parent aa335d38d2
commit ffaa48e228
2 changed files with 8 additions and 8 deletions

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
Fetches repo updates
Fetches Git repo updates
.DESCRIPTION
This PowerShell script fetches the latest updates into a local Git repository (including submodules).
.PARAMETER RepoDir
Specifies the path to the Git repository.
Specifies the file path to the local Git repository (default is working directory).
.EXAMPLE
PS> ./fetch-repo C:\MyRepo
.LINK
@ -22,11 +22,11 @@ try {
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/3) Checking local repository... 📂$RepoDir"
Write-Host "⏳ (2/3) Checking repository... 📂$RepoDir"
if (!(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
$RepoDirName = (Get-Item "$RepoDir").Name
Write-Host "⏳ (3/3) Fetching latest updates... "
Write-Host "⏳ (3/3) Fetching updates... "
& git -C "$RepoDir" fetch --all --recurse-submodules --prune --prune-tags --force
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }