Skip to content

Instantly share code, notes, and snippets.

View int2001's full-sized avatar

Joerg (DJ7NT) int2001

View GitHub Profile
@leshill
leshill / git-prunelocal
Last active April 15, 2024 13:13
Prune local tracking branches that have been removed upstream. Place file in your path (perhaps `~/bin` or `~/scripts`).
#!/bin/bash
#
# Prune local tracking branches that have been removed upstream.
# Your remote tracking branches can be removed automatically by setting `fetch.prune` to true or running `git fetch -prune`.
# Another command to clean up your remote tracking branches is `git remote prune <remote>`.
#
# Author: @leshill
# https://gist.github.com/leshill/9a1088a17f94cef24831
if [[ $# = 1 && $1 == '-n' ]]; then