Skip to content

Instantly share code, notes, and snippets.

@ahmad-reza619
Created March 5, 2020 07:25
Show Gist options
  • Save ahmad-reza619/7368985f5407578dc1f0a744bb9bb956 to your computer and use it in GitHub Desktop.
Save ahmad-reza619/7368985f5407578dc1f0a744bb9bb956 to your computer and use it in GitHub Desktop.
Delete local branch that is not exist on remote
The command for this is
`git fetch --prune`
and then
`git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d`
original: https://stackoverflow.com/questions/13064613/how-to-prune-local-tracking-branches-that-do-not-exist-on-remote-anymore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment