dahlbyk/posh-git — pull request #159 by tkirill (2014-10-02 13:34:24+00:00)
Title: Remove merged branches

Add the cmdlets for removing merged branches:

* Remove-MergedLocalGitBranches -- removes local merged branches.
* Remove-MergedRemoteGitBranches -- removes remote merged branches.
* Remove-MergedGitBranches -- removes both local and remote merged branches.

Implementation placed in the separate file GitRemoveMergedBranches.ps1 although most of other exported cmdlets sit in GitUtils.ps1. Hope it's not a code style rule to place everything inside GitUtils.ps1.

This is how these cmdlets work.

**Remove-MergedLocalGitBranches**

1. Call `git branch --merged`.
2. For each line trim whitespaces from both sides.
3. Filter out line starting with "*" -- it is the current branch.
4. Filter out ignored branches -- master and develop by default.
5. If no branch remains then print message and return.
6. For each remaining branch call `git branch -d $item`.

**Remove-MergedRemoteGitBranches**

Works same as Remove-MergedLocalGitBranches except three things:

1. List of merged branches is retrieved by `git branch -r --merged`.
2. Slightly more complex parsing and filtration. We need to filter out the line with "/HEAD ->" and cut off "/" part from a beginning of each line.
3. Removes branch with `git push origin :$item`.

**Remove-MergedGitBranches**
This one simply calls previous two cmdlets.

All three cmdlets support -WhatIf and -Confirm ([link1](http://blogs.technet.com/b/heyscriptingguy/archive/2012/10/02/build-your-own-powershell-cmdlet-part-4-of-9.aspx), [link2](http://becomelotr.wordpress.com/2013/05/01/supports-should-process-oh-really/).

I haven't tested it enough yet to my shame but I think it is a good idea to create PR to receive feedback as soon as possible.

fixes #79