18

I would like to show how many changes (insertions+deletions) I made on a feature branch. Is there a way to get a summary of the git log --stat output for the changes between 2 commits (branch root / tip).

Thanks.

opatut
  • 6,708
  • 5
  • 32
  • 37
  • Note: in addition of `git --stat`, you might be interested in the Git 2.17 (Q2 2018) feature `git --compact-summary`: see [my answer here](https://stackoverflow.com/a/49330686/6309). – VonC Mar 16 '18 at 23:11

2 Answers2

23

for a feature branch you want to use

git diff --stat dev..feature

this relies on not doing back merges. See my post here: http://dymitruk.com/blog/2012/02/05/branch-per-feature/

--stat can take parameters. This is useful if you have a wider terminal. You can do --stat=200 to say that your display can accommodate 200 columns.

If you want to use this in a script, use --numstat instead. It will not truncate paths.

Hend El-Sahli
  • 6,268
  • 2
  • 25
  • 42
Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
8

use git diff

git diff --stat <branch root> HEAD
interskh
  • 2,511
  • 4
  • 20
  • 20