Skip to content

Instantly share code, notes, and snippets.

@davekonopka
Created February 17, 2023 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davekonopka/cee79d34e72d67b6f15a1d5666046ce7 to your computer and use it in GitHub Desktop.
Save davekonopka/cee79d34e72d67b6f15a1d5666046ce7 to your computer and use it in GitHub Desktop.
macOS stale local branches for github squash and merge
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