Skip to content
Snippets Groups Projects

Git: Prune local branches that no longer exist on remote repository

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by David Dorchies
    Edited
    git-remove-untracked.sh 145 B
    git fetch -p ; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment