Created
May 27, 2020 01:12
-
-
Save andrewfowlie/b5f455f0fc2f2fb4cd919c47424f04b4 to your computer and use it in GitHub Desktop.
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_branch_search_stale { | |
echo "ahead | behind | branch name" | |
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/remotes | \ | |
while read remote | |
do | |
git rev-list --left-right origin/master...${remote} -- 2>/dev/null >/tmp/git_upstream_status_delta || continue | |
BEHIND=$(grep -c '^<' /tmp/git_upstream_status_delta) | |
AHEAD=$(grep -c '^>' /tmp/git_upstream_status_delta) | |
echo "$AHEAD $BEHIND $remote" | |
done | \ | |
sort -n | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment