Home > front end >  How to check file/directory changes of a multi directory git repository between two git commits?
How to check file/directory changes of a multi directory git repository between two git commits?

Time:12-22

How to check file/directory changes of a multi directory git repository between two git commits?

In linux/bash we need to findout changes to a directory of multi-directory(e-store) git repository, say it has inventory-dir, order-dir, purchase-dir etc.., directories.

So basically after we do git pull we want to know in which folderes/directories files changes were made between present changes & last commit, and based on that output take an appropriate call.

We tried to use below git commands, but not sure that's the right way to proceed.

git diff inventory-dir

git log --name-status -2 inventory-dir

CodePudding user response:

You might be looking for

git diff @^1

but to reduce the result to a tractable list of just file names you could add

--stat

or

--compact-summary

or merely

--name-only

Of those, my favorite is --compact-summary — it's tremendously informative while confining the output to one line per file. So then if you have a top-level directory myDirectory to which you wish to confine your attention, you would say

git diff --compact-summary @^1 -- myDirectory
  • Related