I want to do a git diff, but only get a list of the files changed and lines changed per file. I have this:
git diff HEAD..origin/dev --name-only
and I get something like this:
assets/shell.sh
package.json
but I am looking for something like this:
assets/shell.sh 33 lines
package.json 5804 lines
is it possible to get such a summary?
You might consider using git diff --shortstat --numstat
.
It shows added and deleted lines.
The output looks something like this:
$ git diff --shortstat --numstat HEAD^^..HEAD
1 1 Jenkinsfile-sciencetest
88 11 README.md
18 15 src/foo.py
1 0 src/bar.py
4 files changed, 108 insertions(+), 27 deletions(-)
For all lines but the last one, the first column is the number of lines added. The second column is the number of lines deleted and the final column is the file name.
The last line provides the summary.