Show only commits in the specified branch or revision range.
By default uses the current branch and defaults to HEAD (i.e. the whole history leading to the current commit).
fileLineRange
Optional field for getting only the commits that affected a specific line range of a given file.
file
Optional file filter for the git log command
execOptions
Type: Object
Specify some options to be passed to the .exec() method:
cwd String Current working directory of the child process
env Object Environment key-value pairs
setsid Boolean
encoding String (Default: 'utf8')
timeout Number (Default: 0)
maxBuffer Number (Default: 200*1024)
killSignal String (Default: 'SIGTERM')
optional fields
An array of fields to return from the log, here are the possible options:
hash - the long hash of the commit e.g. 7dd0b07625203f69cd55d779d873f1adcffaa84a
abbrevHash - the abbreviated commit hash e.g. 7dd0b07
treeHash - the tree hash of the commit
abbrevTreeHash - the abbreviated commit hash
parentHashes - the parent hashes
abbrevParentHashes - the abbreviated parent hashes
authorName - author name of the commit
authorEmail - author email of the commit
authorDate - author date of the commit
authorDateRel - relative author date of the commit
committerName - committer name
committerEmail - committer email
committerDate - committer date
committerDateRel - relative committer date
subject - commit message (first line)
body - commit body
rawBody - raw body (subject + body)
tag - raw tag information of commit
Defaults to 'abbrevHash', 'hash', 'subject' and 'authorName'.
How it works
This module works by executing a child process (using child_process.exec()) to the git executable, then parsing the stdout into commits. This is done using the --pretty command line option which allows you to provide a custom formatter to git log. To enable easy parsing the format is delimited by a tab (\t) character.
Example
The following is an example of what a parsed commit might look like.