Determine If Any File Changed In Directory For Latest Git Commit
You can get the added, modified, deleted and renamed files in the latest commit with:
git diff --name-only --diff-filter=AMDR --cached @~..@
To get the changes affecting a specific directory, filter the output using grep
. For example:
changes() {
git diff --name-only --diff-filter=AMDR --cached @~..@
}
if changes | grep -q dirname {
echo "start expensive operation"
}