Created
          December 10, 2018 15:05 
        
      - 
      
- 
        Save MrJerB/13993847c1af5192eb2e87824f69b7c7 to your computer and use it in GitHub Desktop. 
    Powershell dev cleanup helpers
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function CleanBinObj { | |
| Get-ChildItem .\ -include bin, obj -Recurse | ForEach-Object ($_) { remove-item $_.fullname -Force -Recurse } | |
| } | |
| Set-Alias Clean-BinObj CleanBinObj -Option AllScope | |
| function CleanGitMergedMaster { | |
| git checkout master; | |
| git branch --merged | | |
| ForEach-Object { $_.Trim('*', ' ') } | | |
| Where-Object { ($_ -ne 'master') -and ($_ -ne 'develop') } | | |
| ForEach-Object { git branch -d $_ } | |
| } | |
| Set-Alias Clean-GitMergedMaster CleanGitMergedMaster -Option AllScope | |
| function CleanGitMergedMaster { | |
| git checkout master; | |
| git branch --merged | | |
| ForEach-Object { $_.Trim('*', ' ') } | | |
| Where-Object { ($_ -ne 'master') -and ($_ -ne 'develop') } | | |
| ForEach-Object { git branch -d $_ } | |
| } | |
| Set-Alias Clean-GitMergedMaster CleanGitMergedMaster -Option AllScope | |
| function CleanGitNoRemote { | |
| git checkout master; | |
| git branch -vv | | |
| Where-Object { $_ -match '\[origin/.*: gone\]' } | | |
| ForEach-Object { $_.Split(" ", [StringSplitOptions]'RemoveEmptyEntries')[0] } | | |
| ForEach-Object { git branch -d $_ } | |
| } | |
| Set-Alias Clean-GitNoRemote CleanGitNoRemote -Option AllScope | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment