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.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment