Git history of code functions

For popular code languages including Python, JavaScript, C/C++, Java, Go, Rust and more, for which Git chunk headers are defined (the user can define them) the Git history of code functions can be checked with the git log -L command to specify the function name and file. For example, to check the Git history of the “main” function in “main.c”:

git log -L :main:main.c

The pickaxe options -S and -G can also be used to check the Git history of code functions by searching for commits that added, modified or removed specific code patterns in the function. For example, to check the Git history of commits that added, modified or removed a variable “hi” in the “main” function in “main.c”:

git log -L :main:main.c -S 'hi' --oneline -1