-
Notifications
You must be signed in to change notification settings - Fork 0
/
Delete subm pretest branches.ps1
45 lines (34 loc) · 963 Bytes
/
Delete subm pretest branches.ps1
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
36
37
38
39
40
41
42
43
44
45
try {
function Delete-Branches {
param (
[string]$folder,
[string]$remote,
[string]$pattern
)
Push-Location $folder
git fetch $remote
$branch_del = @()
foreach ($branch in git branch -r --list "$remote/$pattern") {
$branch = $branch.Trim().SubString($remote.Length+1)
if ($branch.EndsWith('960')) { continue }
if ($branch.EndsWith('962')) { continue }
if ($branch.EndsWith('1159')) { continue }
if ($branch.EndsWith('1215')) { continue }
if ($branch.EndsWith('1223')) { continue }
Write-Host "Deleting branch: $branch"
$branch_del += $branch
}
git push $remote --delete $branch_del
Pop-Location
}
Delete-Branches '.\DataScraping\Reps\OpenCL-Docs\' 'SunSerega' 'pretest/*'
Delete-Branches '.\DataScraping\Reps\OpenGL-Registry\' 'SunSerega' 'pretest/*'
Delete-Branches '.' 'origin' 'subm-pretest/*'
}
catch {
Write-Host "An error occurred:"
Write-Host $_
#pause
exit 1
}
pause