How to list files modified by git pull/git merge

git

in one of our projects, MysQL-Dumps are synced with git. One file for each table in the database.
After pulling/merging the dumps are imported to the local database with a hook. The problem is now, I need to find all table dumps that were changed with the pull to import only these.
How can I get the post-merge-hook to know, which files changed?
It is possibly not only one commit before that gets merged, usually, there are more commits.

How can I get a list of modified files?

Best Answer

git diff --name-only SHA1 SHA2

Use git log to get git commit ids. Use just git diff SHAx if you just want diff against latest head that you have pulled.

Before you git pull do git log or git status to get the SHAx. You can do git fetch instead of pull and do log and diff before you do merge.

Related Question