Skip to main content

Git

Module to generate git related entries.

Overview

{{$git.commitEntry}} generates a random commit entry as printed by git log. This includes a commit hash {{$git.commitSha}}, author, date {{$git.commitDate}}, and commit message {{$git.commitMessage}}. You can also generate a random branch name with {{$git.branch}}.


branch

Generates a random branch name.

Returns: string

Examples

{{$git.branch}}  // 'alarm-copy'

commitDate

Generates a date string for a git commit using the same format as git log.

Parameters

NameTypeDefaultDescription
refDatestring | number | Date{{$date.now}} The date to use as reference point for the commit.

Returns: string

Examples

{{$git.commitDate}}  // 'Fri Aug 30 04:24:54 2024 -0700'
{{$git.commitDate(refDate='2020-01-01')}} // ‘Tue Dec 31 17:27:55 2019 -0200’

commitEntry

Generates a random commit entry as printed by git log.

Parameters

NameTypeDefaultDescription
eol'LF' | 'CRLF''CRLF'Choose the end of line character to use.'LF' = '\n','CRLF' = '\r\n'
mergeboolean{{$datatype.boolean(probability=0.2)}}Set to true to generate a merge message line.
refDatestring | number | Date{{$date.now}} The date to use as reference point for the commit.

Returns: string

Examples

{{$git.commitEntry}}  // 
'commit 5361577f8f0cead32aeed70e5c14f4f8cedac35e
Author: Verlie_McCullough42 <Verlie.McCullough@hotmail.com>
Date: Fri Aug 30 01:03:23 2024 +1200

bypass redundant capacitor’

commitMessage

Generates a random commit message.

Returns: string

Examples

{{$git.commitMessage}}  // 'compress solid state firewall’

commitSha

Generates a random commit sha.

By default, the length of the commit sha is 40 characters.

For a shorter commit sha, use the length option.

Usual short commit sha length is:

7 for GitHub 8 for GitLab

Parameters

NameTypeDefaultDescription
lengthnumber40The length of the commit sha.

Returns: string

Examples

{{$git.commitSha}} // '0fce0cd84e9d64faf6b30c3eaed0a8bfe1ef43a5’
{{$git.commitSha(length=7)}} // 'fdf87b3’