Skip to content

Instantly share code, notes, and snippets.

@kjerk
Forked from ofiesh/git-loglive
Last active December 28, 2015 19:29
Show Gist options
  • Save kjerk/7550584 to your computer and use it in GitHub Desktop.
Save kjerk/7550584 to your computer and use it in GitHub Desktop.
Powershell version for git-loglive with cmdlet binding for default params and documentation sytax so get-help works on the command.
function Git-Loglive()
{
<#
.SYNOPSIS
Outputs git log information live.
.DESCRIPTION
Outputs log information in a loop with a specified polling rate.
.PARAMETER lines
The number of log lines to output.
.PARAMETER sleep
The poll rate of the log in seconds (decimals okay).
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false,Position=1)]
[string]$lines = 20,
[Parameter(Mandatory=$false,Position=2)]
[string]$sleep = 10
)
while($true)
{
cls
git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all -$lines
sleep $sleep
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment