linux
Git Log - Commit
Message CSV
This one liner prints a comma delimited list of today's git log entries.
git log --format="%s" --since=yesterday | perl -pe "s/\n/$1, /" | perl -pe 's/Merge[^,]*, //'
Note the pipes
, in Linux that passes the output of the command to the next command chained by the pipe. There are two pipes here.
|
The output of
is quite common, and
git log
and
git log -p
are also quite useful for reveiwing commit histories.
git log --stat
In this case we are asking the output of
to have the
git log
of
--format
. There are many other valid placeholders for
%s
. Here is a list from that link:
git log --format="<PLACEHOLDER>"
- '%H': commit hash
- '%h': abbreviated commit hash
- '%T': tree hash
- '%t': abbreviated tree hash
- '%P': parent hashes
- '%p': abbreviated parent hashes
- '%an': author name
- '%ae': author email
- '%ad': author date (format respects --date= option)
- '%aD': author date, RFC2822 style
- '%ar': author date, relative
- '%at': author date, UNIX timestamp
- '%ai': author date, ISO 8601 format
- '%cn': committer name
- '%ce': committer email
- '%cd': committer date
- '%cD': committer date, RFC2822 style
- '%cr': committer date, relative
- '%ct': committer date, UNIX timestamp
- '%ci': committer date, ISO 8601 format
- '%d': ref names, like the --decorate option of linkgit:git-log[1]
- '%e': encoding
- '%s': subject
- '%f': sanitized subject line, suitable for a filename
- '%b': body
- '%B': raw body (unwrapped subject and body)
- '%N': commit notes
- '%gD': reflog selector, e.g., `refs/stash@\{1\}`
- '%gd': shortened reflog selector, e.g., `stash@\{1\}`
- '%gs': reflog subject
- '%Cred': switch color to red
- '%Cgreen': switch color to green
- '%Cblue': switch color to blue
- '%Creset': reset color
- '%C(...)': color specification, as described in color.branch.* config option
- '%m': left, right or boundary mark
- '%n': newline
- '%%': a raw '%'
- '%x00': print a byte from a hex code
- '%w([
[, [, ]]])': switch line wrapping
Note that some of the placeholders require other options
The perl switches just do some text manipulation to remove Merge entries and create a csv out of the list created by the
command.
git log --format="%s"
Last Updated: 2014-11-04 14:06:59