Is there any git command which allows to check if a file was changed during last commit?
I'd like to check if a file which contains a version number was updated, otherwise the dev shall receive a warning not to release the software to an integration environment before a the version was bumped up.
git diff --name-only HEAD~1 HEAD | grep somefile.txt
This command assumes that you want to check whether the file
somefile.txt changed in the last commit. If you want to check whether
somefile.txt changed between any two commits, then use
git diff --name-only SHA1 SHA2 | grep somefile.txt
SHA2 are the hashes of the two commits bounding the diff.