1

I read here https://stackoverflow.com/a/424142/1462297 that I can get the list of files that have changed in a commit using:

git diff-tree --no-commit-id --name-only -r <commit>

The list contains relative paths to the repository's root (location of my .git).

How can I get this same list, but with an absolute path instead?

Community
  • 1
  • 1
strontivm
  • 59
  • 9

1 Answers1

1
git diff --name-only <commit-ish>^! | sed "s|^|$(git rev-parse --show-toplevel)/|"

or of course if it is for a script and thus you want to use plumbing instead of porcelain

git diff-tree --no-commit-id --name-only -r <commit-ish> | sed "s|^|$(git rev-parse --show-toplevel)/|"
Vampire
  • 35,631
  • 4
  • 76
  • 102
  • @ojrask sorry for rejecting your edit, but you removed essential information and also your result was technically wrong and additionally the stuff you added was not about what the OP asked. – Vampire Apr 21 '16 at 12:35
  • There's a slash missing, but I managed to add that one. Thanks! – strontivm Apr 21 '16 at 18:48