73

I want to look at how my code base has grown over time. GitHub has a nice +/- display along the list of checkins which gives a sense of this. Is there something similar I can use with my Google Code hosted repo or offline?

2
  • 1
    I'm voting to close this question as off-topic because the usage of tools specific to software development. These questions belong on Stack Overflow, but this question is too old to migrate.
    – Thomas Owens
    Commented Jul 16, 2015 at 11:59
  • recommended reading: Where does my git question go?
    – gnat
    Commented Jul 16, 2015 at 12:00

2 Answers 2

106

There are a few options natively in Git to get data about the changes.

git log --stat will show the amount each file was changed.

git whatchanged gives some detail into the files that were modified.

git diff --stat <sha1> <sha2> gives the files and the amount of changes between two commits.

There are many other blogs that give various formatted logs. A google search can point you at these. Also doing git log --help will give the various options for formatting the history of your repo. Git has the ability to give you quite a bit of data through the various command line log options (filtering by author, file, etc).

3
  • 9
    Beautiful! Thanks. Now I also see --numstat provides a less sugary but clean alternative format. Commented May 27, 2013 at 7:03
  • 30
    --shortstat will just print out the totals.
    – casey
    Commented Sep 27, 2014 at 1:07
  • 2
    keep in mind that git diff --stat <sha1> <sha2> doesn't includes insertions and deletions in <sha1>, so you would have to put the sha of commit just before <sha1> to includes <sha1> Commented Feb 13, 2019 at 13:48
26

If you know the commits you would like to compare, you could try using the git diff command with the --stat argument. It gives output like this:

$ git diff --stat HEAD^ HEAD
_layouts/default.html |    1 -
_sass/_variables.scss |    2 +-
_sass/main.scss       |   42 +++++++++++++++---------------------------
3 files changed, 16 insertions(+), 29 deletions(-)
1
  • 4
    Always love an example that works for most cases (HEAD - 1) instead of an abstraction. Thanks Mike!
    – SimplGy
    Commented Apr 19, 2016 at 22:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.