-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGitPull.ps1
More file actions
35 lines (28 loc) · 865 Bytes
/
GitPull.ps1
File metadata and controls
35 lines (28 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Set the path to the directory containing the files
param (
[string]$parent_directory
)
. ./Resolve-Rebase.ps1
if (-not $parent_directory) {
$parent_directory = Split-Path -Path $MyInvocation.MyCommand.Path -Parent # or $PWD
}
Set-Location -Path $parent_directory
Resolve-Rebase $parent_directory
Invoke-SafePull $parent_directory
#git pull --rebase --strategy-option=theirs
Get-ChildItem -Path $parent_directory -Recurse -Directory | ForEach-Object {
$directory = $_.FullName
if (Test-Path "$directory/.git") {
try {
Write-Host "Pulling repository in $directory"
Push-Location $directory
Resolve-Rebase $directory
Invoke-SafePull $directory
} catch {
Write-Host "Error in $directory : $_" -ForegroundColor Red
} finally {
Pop-Location
}
}
}
Set-Location -Path $parent_directory