4

How do I show full paths in git diff? One can use '--dst-prefix=$PWD' and '--src-prefix=$PWD' but this is fragile as it won't work in many cases, eg with --no-index, or when running the commond from a subdirectory without using --relative=realpath_to_cwd

timotheecour
  • 3,104
  • 3
  • 26
  • 29

1 Answers1

1

It should be possible to:

That would be more robust than $PWD.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    4 years later ;) What command did you type? With which version of Git? – VonC Aug 23 '18 at 08:57
  • here's an example command (using git version 2.17.1 but irrelevant) "git diff --no-index `get_file1` `get_file2`" The cmd `get_file1` or ``get_file2` could return either absolute or relative path, so '--dst-prefix=$PWD' won't work (eg when path is already absolute) `git rev-parse --show-toplevel` makes no sense in the case of `--no-index` in general, since the files i'm comparing may not even be in a git repo. more info [here](https://public-inbox.org/git/CANri+ExMY9G9aSm2TumHd8a9p2ZVXqcBOV-H=7P-_Xh_ng=Cpg@mail.gmail.com/T/#rd4b7a754b4771346a4997b30f3e8c0b41964c0ac) – timotheecour Aug 24 '18 at 21:14