mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 21:07:40 +02:00
Update fetch-repo.ps1 and pull-repo.ps1
This commit is contained in:
@ -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" }
|
||||
|
||||
|
Reference in New Issue
Block a user