Created
October 6, 2023 13:25
-
-
Save mpdaugherty/3de536a58a447281bd22703dfa0beae0 to your computer and use it in GitHub Desktop.
View local git branches ahead/behind of main
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
#!/bin/bash | |
for branch in $(git branch | sed 's/* //'); do | |
ahead=$(git log --oneline main..$branch | wc -l | tr -d ' '); | |
behind=$(git log --oneline $branch..main | wc -l | tr -d ' '); | |
printf "+%5s, -%5s : %s\n" "$ahead" "$behind" "$branch"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment