Skip to content

Instantly share code, notes, and snippets.

View Norfeldt's full-sized avatar

Lasse Nørfeldt Norfeldt

View GitHub Profile
@Norfeldt
Norfeldt / git-cleanup
Created August 5, 2020 08:12 — forked from nook-ru/git-cleanup
Clean up old git branches
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged master | grep -v 'master$' | grep -v 'dev$' | xargs git branch -d