Making git diff --stat show full file path

git, git-diff

Solution

By default `git diff` truncates its output to fit into a 80-column terminal.

You can override this by specifying values using the `--stat` option:

--stat[=<width>[,<name-width>[,<count>]]]
       Generate a diffstat. You can override the default output width for
       80-column terminal by --stat=<width>. The width of the filename
       part can be controlled by giving another width to it separated by a
       comma. 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>.

For example, by setting the output value to a very large number:

git diff --stat=10000

Note that produces the path relative to the root of the git repository.

(For scripting you might want to use `git diff-tree` directly since it's more of a "plumbing" command, although I suspect you'll be fine either way. Note that you need the same extra text with `--stat` when using `git diff-tree`. The essential difference between using the `git diff` "porcelain" front end, and the `git diff-tree` plumbing command, is that `git diff` looks up your configured settings for options like `diff.renames` to decide whether to do rename detection. Well, that, plus the front end `git diff` will do the equivalent of `git diff-index` if you're comparing a commit with the index, for instance. In other words, `git diff` reads your config and invokes the right plumbing automatically.)

Problem

On doing `git diff --stat` some files are listed with full path from repository base but some files are listed as: ``` .../short/path/to/filename. ``` That is the path starts with `...` and only short path is shown. I would like `git diff` to list full file path for all files for it to be easily processed by a script. Is there some way I can get `git diff` to always show full path

Original source