Skip to content

Instantly share code, notes, and snippets.

@rgardner
Last active August 29, 2015 13:58
Show Gist options
  • Save rgardner/10338498 to your computer and use it in GitHub Desktop.
Save rgardner/10338498 to your computer and use it in GitHub Desktop.
Git-fu

SO: How to get the git commit count?

Update: If all you need is a commit count, and you're running a newer version of git, you can use the following command:

git rev-list HEAD --count

Thanks ctrueden for pointing this out.

Original answer:

Adding to Rayne's answer, to strip out the blank lines and usernames from the output, and get just the commit count, run it through grep:

git shortlog | grep -E '^[ ]+\w+' | wc -l

The lines that have commit messages begin with some spaces.

SO: Untrack files from git

git update-index should do what you want

This will tell git you want to start ignoring the changes to the file

git update-index --assume-unchanged path/to/file

When you want to start keeping track again

git update-index --no-assume-unchanged path/to/file

Github Documentation: update-index

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