2

I am able to get the files changes and lines affected along with a lot of other stuff by this command

git log -p -1 --stat --color=never

But I just need file names and no of lines affected, how would I get that

Cœur
  • 37,241
  • 25
  • 195
  • 267
tejas
  • 1,795
  • 1
  • 16
  • 34

2 Answers2

4

I guess you are looking for

git diff --stat --summary -M HEAD HEAD~

it outputs the stats in the same format as a git merge does.

Or without color for two other commits, e.g.

git diff --stat --summary --no-color -M  6c1dea3 e8f4b44

or only the staging area

git diff --cached --stat --summary -M
René Link
  • 48,224
  • 13
  • 108
  • 140
  • That looks closer to what the OP is after. I didn't interpreted the "no of lines affected" as "number of lines affected" (I initially thought the OP did *not* want the lines displayed!). So +1. – VonC Feb 20 '15 at 09:34
  • yup, I should have put "no." at least. but this is kinda what I wanted – tejas Feb 20 '15 at 09:48
0

If you can ignore the blank lines, as mentioned in "How to have git log show filenames like svn log -v", you can use:

git log --name-only --pretty=format: <branch name>
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • umm this not what i was looking for, the command in the question gives output like `filenamewithfullpath.cpp | lines changed` along with commit message diff etc... i just want `filenamewithfullpath.cpp | lines changed` – tejas Feb 20 '15 at 07:57
  • @tejashs Strange: I don't see any "lines changed" in the output of that command. Only `filenamewithfullpath.cpp`. – VonC Feb 20 '15 at 07:58