Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git diff -name-only with full file path

Tags:

git

currently using:

git diff -name-status

Now this will only give me the following output:

README.md
created.txt
test.txt

However I am looking for something more like this:

/User/github/README.md
/User/github/created.txt
/User/github/test.txt

Does anyone know if something like this is possible?

To clarify: the comment from the linked post states: All output will return paths relative to git rev-parse --show-toplevel this is exactly the issue as I would want the path prior to the top level to be included.

like image 522
A. Hill Avatar asked Mar 21 '26 23:03

A. Hill


1 Answers

Building on torek's answer, I was able to achieve this in one line using the --line-prefix flag:

git diff --name-only --line-prefix=`git rev-parse --show-toplevel`/ HEAD release
like image 93
tfwright Avatar answered Mar 24 '26 17:03

tfwright