Git plumbing command to find out which files have been changed in a given revision
I’ve created a hook that sends out notification emails when a developer pushes an update to his shared repository. This email includes a list of changed files, example:
A __classes/Page/Activity.php M __config/Scheme.php
that I generate using the following bit of bash:
$(git diff "$newrev"^ "$newrev" --name-status)
This works fine. However, I’m trying to port all this now to the well-known post-receive-email hook. This hook does have a
hooks.showrev configuration directive, but this I think this only allows for the revision number (
%s) to be used once in the command. So this doesn’t work:
showrev = "git diff %s^ %s --name-status"
There must be a ‘plumbing’ command that does just this. Can anyone point me in the right direction? 🙂
2 Solutions collect form web for “Git plumbing command to find out which files have been changed in a given revision”
How about using the following?
showrev = "git show --name-status --pretty=format: %s"
git show is porcelain rather than plumbing, but I think this is what you want.
git whatchanged -1 <rev> might be a good starting point, and has a number of additional options for massaging the output format. Not sure you can get exactly the format you quoted above, but you should be able to get something comparable.