git log --max-count=15 --pretty="format:%C(dim green) %<(9,trunc)%ar %C(bold magenta)%h %C(bold green)%<(12,trunc)%an %C(bold
yellow)%<(113,trunc)%s" --no-merges
Notice ...yellow)%<(113,trunc) the 113 is the length to trim the comments to allowing full customization without --oneline overriding your settings.
As has been said this could be aliased or as I have wrapped in a powershell function.
The following is beyond the OP but brings some value to the thread.
I know I got carried away but it is what we do.
function logs() {
<#
.SYNOPSIS
Shows my logs
.DESCRIPTION
Returns an abreviated list of logs meeting the filtering provided including max returned, committor by case sensitive pattern, branch, local or remote, and a 'my' shourcut to get the callers commits only
.EXAMPLE
PS>logs
[ Basic usage gets maximum 15 logs from the origin/<current branch> ]
origin/master logs
git log origin/master --max-count=15 --pretty="format:%C(dim green) %<(9,trunc)%ar %C(bold magenta)%h %C(bold green)%<(12,trunc)%an %C(bold yellow)%<(113,trunc)%s"
2 days .. b6e4d0b Joe Johnston Added Posh
2 days .. 0f1a166 Joe Johnston Updated the profile system
4 days .. dfd3115 Joe Johnston added .net install and pinned applications. Updated git functions
6 weeks.. 47bd9e9 Joe Johnston updated functions
3 month.. 5148f09 Joe Johnston initial add
.EXAMPLE
PS>logs -l
[ Usage gets maximum 15 local logs from the <current branch> ]
logs
git log --max-count=15 --pretty="format:%C(dim green) %<(9,trunc)%ar %C(bold magenta)%h %C(bold green)%<(12,trunc)%an %C(bold yellow)%<(113,trunc)%s"
3 hours.. efb36e9 Joe Johnston updated profile to set-execution
3 hours.. 4355a00 Joe Johnston Merge branch 'master' of https://github.com/xxx
3 hours.. 84cd380 Joe Johnston updated gitfunctions - added undomerge
2 days .. b6e4d0b Joe Johnston Added Posh
2 days .. 0f1a166 Joe Johnston Updated the profile system
4 days .. dfd3115 Joe Johnston added .net install and pinned applications. Updated git functions
6 weeks.. 47bd9e9 Joe Johnston updated functions
3 month.. 5148f09 Joe Johnston initial add
.EXAMPLE
logs 25
[ Usage gets maximum 25 logs from the origin/<current branch> ]
.EXAMPLE
logs -m -c 20
[ Usage gets maximum 20 local logs from the <current branch> commited by me]
.EXAMPLE
logs -b dev/iOS -c 25 -l -c "Jackson"
[ Usage gets maximum 20 local logs from the <current branch> commited by the <pattern> Jackson]
#>
[cmdletbinding()]
Param(
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('c')]
[int]$Count = 15,
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('b')]
[string]$Branch = "Current",
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('u')]
[Alias('user')]
[string]$Committer = "",
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('m')]
[Alias('me')]
[Alias('onlyme')]
[switch]$My = $false,
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('g')]
[switch]$Graph = $false,
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('sm')]
[Alias('merge')]
[switch]$ShowMerges = $false,
[parameter(Mandatory=$false,ValueFromPipeline)]
[Alias('r')]
[switch]$Remote = $false
)
$merge = '--no-merges';
if ($ShowMerges) {
$merge = '';
}
$Pretty = "--pretty=`"format:%C(dim green) %<(9,trunc)%ar %C(bold magenta)%h %C(bold green)%<(12,trunc)%an %C(bold yellow)%<(113,trunc)%s`"";
#git config --global format.pretty $Pretty
if ($Branch -eq "Current") {
$Branch = git symbolic-ref --short HEAD;
write-host "************************************************";
} else {
write-host "================================================";
}
if ($Remote -eq $true) { $Where = "origin/$Branch"; }
if ($Graph -eq $true) { $GraphTag = "--graph"; }
if([string]::IsNullOrEmpty($Committer) -eq $false) {
$Who = $Committer;
$Committer = "--committer=" + $Committer;
write-host $Who
}
if ($My -eq $true) {
$me = git config user.name;
$Committer = "--committer=`"$me`"";
$Who = "**MY**";
}
write-host "$Who $Where logs" -foregroundcolor "Red";
$commandOut = "git log $Where $GraphTag --max-count=$Count $Pretty $Committer $GraphTag $merge";
write-Verbose $commandOut;
write-host;
git log $Where --max-count=$Count $Pretty $Committer $GraphTag $merge
write-host
}