Reputation: 11334
I want to only list all files across all commits with its 'graph' but I am unable to get it to look clean especially with leading pipes|
that truncate the various file names:
Expected output:
app/code/src/a/b/c.php | 5 ++---
app/code/src/a/b/d.php | 10 +++++-----
...
I am getting the git logs like this:
git log --stat --pretty=short --graph --oneline
I can pipe this output to grep like so to only pick the lines with the graph in them like so:
git log ... | grep -i " \| "
This is fine except when it reaches log lines formatted like so that truncates the filenames and the graph:
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ...ata.php | 239 +-
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ...Api.php | 28 +-
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ...ons.php | 62 -
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ...ion.php | 129 -
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ...ask.php | 9 -
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ...ver.php | 269 +-
I'm not concerned about duplicates (preferred actually) but want to see the output tabulated with filename | graph +/-
if possible. How can I achieve that?
I'm guessing that for large numbers even the symbols +...-
will be truncated. If it isn't preservable then even something like this (or close enough) would be okay:
filename | #insertions | #deletions
I have no idea if this is even possible via git logs or would it need something else to bring to fruition.
Upvotes: 0
Views: 230
Reputation: 52151
Try replacing --stat
with --numstat
:
--numstat
Similar to
--stat
, but shows number of added and deleted lines in decimal notation and pathname without abbreviation, to make it more machine friendly. For binary files, outputs two-
instead of saying0 0
.
Alternatively, --stat
takes options to adjust the number of displayed characters :
--stat[=<width>[,<name-width>[,<count>]]]
Generate a diffstat. By default, as much space as necessary will be used for the filename part, and the rest for the graph part. Maximum width defaults to terminal width, or 80 columns if not connected to a terminal, and can be overridden by
<width>
.
The width of the filename part can be limited by giving another width<name-width>
after a comma. The width of the graph part can be limited by using--stat-graph-width=<width>
(affects all commands generating a stat graph) or by settingdiff.statGraphWidth=<width>
(does not affect git format-patch). By giving a third parameter<count>
, you can limit the output to the first<count>
lines, followed by...
if there are more.These parameters can also be set individually with
--stat-width=<width>
,--stat-name-width=<name-width>
and--stat-count=<count>
.
you can provide an very high width value, e.g --stat=10000
Upvotes: 1