There are a lot of changes in the data contract between two commits. These are mixed into a load of other (functional, non-contract) changes. I want to be able to see them easily. How do I do this?
Option 1 (step by step)
# Get the names of the files changed between the two commits
git diff --name-only HEAD~1 HEAD > c:/dave/changes.diff
# Filter to those with contract changes
grep Atmos/Smt/OperationOptimiserV2/Contracts/ c:/dave/changes.diff > c:/dave/contractfileschanged.diff
while IFS= read -r f; do
if [ -f "$1/${f##*/}" ]; then
echo rm -- "$1/${f##*/}"
fi
echo $f
git diff HEAD~1 HEAD $f >> c:/dave/contractchanges.diff
done < c:/dave/contractfileschanged.diff
Option 2 (inline)
echo "" > c:/dave/contractchanges.diff
# Pipe the git diff output into grp
for f in $(git diff --name-only HEAD~1 HEAD | grep Atmos/Smt/OperationOptimiserV2/Contracts/ )
do
git diff HEAD~1 HEAD $f >> c:/dave/contractchanges.diff
done
Option 2a (Option 2 in a single line)
for f in $(git diff --name-only HEAD~1 HEAD | grep Atmos/Smt/OperationOptimiserV2/Contracts/ ); do git diff HEAD~1 HEAD $f >> c:/dave/contractchanges.diff; done