diff --git a/README.md b/README.md index a6644a6..0b3d5c0 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ For clarity's sake all examples in this document use a customized bash prompt in - [Finding](#finding) - [I want to find a string in any commit](#i-want-to-find-a-string-in-any-commit) - [I want to find by author/committer](#i-want-to-find-by-authorcommitter) + - [I want to list commits containing specific files](#i-want-to-list-commits-containing-specific-files) - [Submodules](#submodules) - [Clone all submodules](#clone-all-submodules) - [Remove a submodule](#remove-a-submodule) @@ -1175,6 +1176,30 @@ $ git log --committer= Keep in mind that author and committer are not the same. The `--author` is the person who originally wrote the code; on the other hand, the `--committer`, is the person who committed the code on behalf of the original author. + +### I want to list commits containing specific files + +To find all commits containing a specific file you can use: + + +```sh +$ git log -- +``` + +You would usually specify an exact path, but you may also use wild cards in the path and file name: + +```sh +$ git log -- **/*.js +``` + +While using wildcards, it's useful to inform `--name-status` to see the list of commited files: + +```sh +$ git log --name-status -- **/*.js +``` + + + ## Submodules