I usually check the changes introduced by a commit with the git show
command. This works well, except when I'm only interested in the changes introduced in a subset of the changed files.
Is there something like git show --exclude some/path
that will do this out of the box?
Translating @DavidN's comment into an answer, here's what you get (people may not realize that "git log" and "git show" take all the same options):
git show -- . ':!some/path'
Requires git 1.9 or newer.
Here's a example showing it in use against the php github repo:
git remote -v
origin https://github.com/php/php-src.git (fetch)
Here's a "--name-only" git show without the exclusion:
git show -p -m --first-parent --name-only --oneline e231830f1683e
e231830 Merge branch 'PHP-5.6.18' into PHP-7.0.3
ext/phar/dirstream.c
ext/phar/tar.c
ext/phar/tests/bug71331.phpt
ext/phar/tests/bug71331.tar
ext/phar/tests/bug71354.phpt
ext/phar/tests/bug71354.tar
ext/phar/tests/bug71391.phpt
ext/phar/tests/bug71391.tar
ext/phar/tests/bug71488.phpt
ext/phar/tests/bug71488.tar
ext/standard/iptc.c
ext/standard/streamsfuncs.c
ext/standard/tests/file/stream_rfc2397_002.phpt
ext/standard/tests/network/socket_get_status_basic.phpt
ext/standard/tests/streams/bug71323.phpt
[etc...]
And here it is excluding "ext/phar":
git show -p -m --first-parent --name-only --oneline e231830f1683e -- . ':!ext/phar'
e231830 Merge branch 'PHP-5.6.18' into PHP-7.0.3
ext/standard/iptc.c
ext/standard/streamsfuncs.c
ext/standard/tests/file/stream_rfc2397_002.phpt
ext/standard/tests/network/socket_get_status_basic.phpt
ext/standard/tests/streams/bug71323.phpt
[etc...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With