Skip to content

Instantly share code, notes, and snippets.

@jonathanmedd
Created December 2, 2021 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanmedd/d3f7093baed8f177d263ba53c29911b8 to your computer and use it in GitHub Desktop.
Save jonathanmedd/d3f7093baed8f177d263ba53c29911b8 to your computer and use it in GitHub Desktop.
Invoke-GitCleanup
function Invoke-GitCleanup {
param (
[Parameter()]
[ValidateNotNullOrEmpty()]
[String]$defaultBranch = 'main',
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[String]$branch
)
git checkout $defaultBranch
git pull
git fetch --prune
git branch -D $branch
git branch -a
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment