Skip to content

Instantly share code, notes, and snippets.

@klaaspieter
Last active November 14, 2020 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaaspieter/908433 to your computer and use it in GitHub Desktop.
Save klaaspieter/908433 to your computer and use it in GitHub Desktop.
Get a revision number from git by counting the number of commits
git rev-list --count --all
@jerrygreen
Copy link

Now it's simply git rev-list --count --all

@klaaspieter
Copy link
Author

Thanks @jerrygreen. Updated.

@jerrygreen
Copy link

jerrygreen commented Nov 9, 2020

Just in case: Github Gists use more granular git rev-list --branches --count for their "Revisions" count, so that's more appropriate to use probably (in most cases)

Sounds weird for a prop name though, because sounds like count of git branch but it's not ;) More info git rev-list --help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment