Updated sync-repo.ps1

This commit is contained in:
Markus Fleschutz
2025-07-27 19:11:42 +02:00
parent e8f668643d
commit 49a85bfa39

View File

@ -4,14 +4,14 @@
.DESCRIPTION .DESCRIPTION
This PowerShell script synchronizes a local Git repository by pull and push (including submodules). This PowerShell script synchronizes a local Git repository by pull and push (including submodules).
.PARAMETER path .PARAMETER path
Specifies the path to the Git repository (current working directory by default) Specifies the file path to the Git repository (current working directory by default)
.EXAMPLE .EXAMPLE
PS> ./sync-repo.ps1 C:\Repos\curl PS> ./sync-repo.ps1 C:\Repos\curl
⏳ (1/4) Searching for Git executable... git version 2.42.0.windows.1 ⏳ (1/4) Searching for Git executable... git version 2.42.0.windows.1
⏳ (2/4) Checking local repository... C:\Repos\curl ⏳ (2/4) Checking local repository... C:\Repos\curl
⏳ (3/4) Pulling remote updates... Already up to date. ⏳ (3/4) Pulling remote updates... Already up to date.
⏳ (4/4) Pushing local updates... Everything up-to-date ⏳ (4/4) Pushing local updates... Everything up-to-date
Synced the 📂curl repo in 5s. Repo 'curl' synchronized in 5s.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -40,9 +40,9 @@ try {
$pathName = (Get-Item "$path").Name $pathName = (Get-Item "$path").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"Synced the 📂$pathName repo in $($elapsed)s." "Repo '$pathName' synchronized in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
exit 1 exit 1
} }