Created
February 17, 2023 17:20
-
-
Save davekonopka/cee79d34e72d67b6f15a1d5666046ce7 to your computer and use it in GitHub Desktop.
macOS stale local branches for github squash and merge
This file contains 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
function git_list_remote_branches() { | |
git ls-remote --heads -q | awk '{ gsub("refs/heads/",""); print $2 }' | sort | |
} | |
function git_list_local_branches() { | |
git branch --format='%(refname:short)' | sort | |
} | |
function git_local_stale_branches() { | |
comm -13 <(git_list_remote_branches) <(git_list_local_branches) | |
} | |
alias gbstale='git_local_stale_branches' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment