Last active
February 5, 2024 03:40
-
-
Save GrayedFox/2b6229e25650afaba6ceabcd4b1ba7de to your computer and use it in GitHub Desktop.
Count how many unique commits are on your current branch
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
#!/usr/bin/env bash | |
BRANCH="main" | |
if [ $# -eq 1 ] ; then | |
BRANCH=$1 | |
fi | |
# count how many commits on your branch are not on the target branch, defaults to main | |
git rev-list HEAD --count ^$BRANCH |
Updated to accept a single argument in case main is not the default branch (i.e. git count master
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to count only unique commits (read: commits not on main/master)