Skip to content

Instantly share code, notes, and snippets.

@myinusa
Created January 26, 2025 15:18
Show Gist options
  • Select an option

  • Save myinusa/edfb14673ebccceff663b94eef6b29b8 to your computer and use it in GitHub Desktop.

Select an option

Save myinusa/edfb14673ebccceff663b94eef6b29b8 to your computer and use it in GitHub Desktop.

Revisions

  1. myinusa created this gist Jan 26, 2025.
    8 changes: 8 additions & 0 deletions git-fetch-prune-all.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    git fetch --prune --all -v && \
    git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -I {} git branch -D {} 2>/dev/null && \
    git remote prune origin && \
    for b in $(git branch -r | tr '/' ' '); do
    if [ "$b" != "HEAD" ]; then
    git checkout "${b#origin/}" && git pull;
    fi;
    done