Created
August 26, 2022 13:40
-
-
Save midwire/42526519a7ddecf79d52eabff8bcd69e to your computer and use it in GitHub Desktop.
[Git - sync local branches with remote] Remove local branches if they don't exist on the remote #git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use git branch -D to remove branches even if they are not fully merged | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment