Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git show --stat listing only the number of files changed, insertions and deletions?

I am using the following Git command to get the data about a particular commit:

  git show <revhash> --stat >> ouput.csv

This is the output I get:

  commit 7bc745a289cf68cb2eba647bbfba9e9ec06eb771
  Author: Stefan Bodewig <[email protected]>
  Date:   Mon Jun 24 15:12:57 2013 +0000

post-process generated javadocs as workaround for CVE-2013-1571 - based on Maven patch by Uwe Schindler - PR 55132

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1496083 13f79535-47bb-0310-9956-ffa450edef68

   CONTRIBUTORS                                       |   1 +
   WHATSNEW                                           |   9 ++
   contributors.xml                                   |   4 +
   manual/Tasks/javadoc.html                          |  12 +++
   .../org/apache/tools/ant/taskdefs/Javadoc.java     | 111 ++++++++++++++++++++-
   .../ant/taskdefs/javadoc-frame-injections-fix.txt  |  37 +++++++
   6 files changed, 171 insertions(+), 3 deletions(-)

I would like to get the list of files changed like this without the other metadata in the following way:

  1 file changed, 1 insertion(+), 1 deletion(-)

I know I can use --shortstat, but it still gives other information such as commit hash, date e.t.c

I think there can be no such thing in git, but what would be the smartest way to parse the output of the last line then?

like image 690
lowlypalace Avatar asked Oct 27 '25 20:10

lowlypalace


1 Answers

I would use --format

git show <commit> --shortstat --format="" >>output.csv
like image 74
Mark Adelsberger Avatar answered Oct 30 '25 10:10

Mark Adelsberger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!