Skip to content

Commit

Permalink
Merge pull request #1714 from NuGet/anurse/branchtools
Browse files Browse the repository at this point in the history
Added scripts to help manage branches
  • Loading branch information
analogrelay committed Nov 4, 2013
2 parents e25edb2 + bdfd473 commit 29d37d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
12 changes: 1 addition & 11 deletions tools/Clean-Branches.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
param([switch]$Force)

$toClean = @(
git branch --merged origin/master -r |
foreach { $_.Trim() } |
where {
($_ -notmatch "origin/pr/\d+") -and
($_ -match "origin/(?<b>[A-Za-z0-9-/]*).*")
} |
foreach { $matches.b } |
where {
@("HEAD","master","dev","dev-start","qa","staging") -notcontains $_
})
$toClean = & "$PSScriptRoot\Get-MergedBranches.ps1"

$pushargs = @($toClean | foreach { ":$_" })
if($Force) {
Expand Down
13 changes: 13 additions & 0 deletions tools/Get-MergedBranches.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
param([string]$ParentBranch = "master")

git branch --merged "origin/$ParentBranch" -r |
foreach { $_.Trim() } |
where { $_ -like "origin*" } |
where {
($_ -notlike "origin/pr*") -and
($_ -notlike "origin/HEAD*") -and
(@("origin/master","origin/dev","origin/staging","origin/dev-start","origin/qa") -notcontains $_)
} |
foreach {
$_.Substring("origin/".Length)
}

0 comments on commit 29d37d9

Please sign in to comment.