diff --git a/README.md b/README.md index 5bf2264..10909d3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_704 TILs and counting..._ +_705 TILs and counting..._ --- @@ -193,6 +193,7 @@ _704 TILs and counting..._ - [Renaming A Branch](git/renaming-a-branch.md) - [Resetting A Reset](git/resetting-a-reset.md) - [Show All Commits For A File Beyond Renaming](git/show-all-commits-for-a-file-beyond-renaming.md) +- [Show Changes For Files That Match A Pattern](git/show-changes-for-files-that-match-a-pattern.md) - [Show File Diffs When Viewing Git Log](git/show-file-diffs-when-viewing-git-log.md) - [Show List Of Most Recently Committed Branches](git/show-list-of-most-recently-committed-branches.md) - [Show The diffstat Summary Of A Commit](git/show-the-diffstat-summary-of-a-commit.md) diff --git a/git/show-changes-for-files-that-match-a-pattern.md b/git/show-changes-for-files-that-match-a-pattern.md new file mode 100644 index 0000000..a3dae94 --- /dev/null +++ b/git/show-changes-for-files-that-match-a-pattern.md @@ -0,0 +1,23 @@ +# Show Changes For Files That Match A Pattern + +The `git show` command allows you to view the changes associated with a +reference, such as a commit sha (e.g. `git show 86748aacf14e`). + +Consider a commit that has changed a bunch of JS files as well as two CSS +files. If we run `git show abcd1234`, we will see all of the changes to each +file which can result in quite a bit of noise. What if we only want to view +the changes to the CSS files? + +We can instruct the command to only show changes to files that match a +pattern by tacking that pattern on to the end. + +```bash +$ git show abcd1234 *.css +``` + +Alternatively, we could scope the output of the command to the files that +live in a certain directory. + +```bash +$ git show abcd1235 src/css +```