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 justgit diff SHAx
if you just want diff against latest head that you have pulled.Before you
git pull
dogit log
orgit status
to get the SHAx. You can dogit fetch
instead of pull and do log and diff before you do merge.