diff --git a/README.md b/README.md index c80fac8..7e6aa0e 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ All commands should work for at least git version 2.13.0. See the [git website]( - [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) + - [I want to view the commit history for a specific function](#i-want-to-view-the-commit-history-for-a-specific-function) - [Find a tag where a commit is referenced](#find-a-tag-where-a-commit-is-referenced) - [Submodules](#submodules) - [Clone all submodules](#clone-all-submodules) @@ -1355,6 +1356,17 @@ While using wildcards, it's useful to inform `--name-status` to see the list of $ git log --name-status -- **/*.js ``` + +### I want to view the commit history for a specific function + +To trace the evolution of a single function you can use: + +```sh +$ git log -L :FunctionName:FilePath +``` + +Note that you can combine this with further `git log` options, like [revision ranges](https://git-scm.com/docs/gitrevisions) and [commit limits](https://git-scm.com/docs/git-log/#_commit_limiting). + ### Find a tag where a commit is referenced To find all tags containing a specific commit: