Skip to content

Instantly share code, notes, and snippets.

@richja
Created July 22, 2020 08:23
Show Gist options
  • Save richja/b9c076ee4ed648cd840434084b48bf7e to your computer and use it in GitHub Desktop.
Save richja/b9c076ee4ed648cd840434084b48bf7e to your computer and use it in GitHub Desktop.
Delete old remote branches on Git
//sort remote branches by oldest last commit date
git branch -r --sort=committerdate | xargs echo
//pick all remote branches and remove origin/ part or use something sed to do it automatically (https://stackoverflow.com/a/40010115)
git push origin --delete <remote branches here>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment