Skip to content

Instantly share code, notes, and snippets.

@grumpyshoe
Created January 4, 2023 08:02
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 grumpyshoe/1413619b0024d223856e94ec7a0c2330 to your computer and use it in GitHub Desktop.
Save grumpyshoe/1413619b0024d223856e94ec7a0c2330 to your computer and use it in GitHub Desktop.
Usefull git commands

Get number of commits

Source: StackOferflow

To see total no of commits you can do as Peter suggested above

git rev-list --count HEAD

And if you want to see number of commits made by each person try this line

git shortlog -s -n

will generate output like this

135  Tom Preston-Werner
15  Jack Danger Canty
10  Chris Van Pelt
7  Mark Reid
6  remi

Source: StackOverflow

Number of commits done since some other commit:

git rev-list HEAD abc0923f --count --first-parent

or the same:

git rev-list abc0923f.. --count --first-parent

or use any other git reference:

git rev-list master tag-v20 --count --first-parent

Count commits done since 2018 year git rev-list HEAD --count --first-parent --since=2018-01-01

Result: 01-01-2018, 01.01.2018, 2018.01.01 also works.

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