Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[ValidateRange(1, 180)]
[int]$daysBack = 7,
[Parameter(Mandatory=$false)]
[string]$author,
[Parameter(Mandatory=$false)]
[switch]$mine
)
if ($mine) {
$author = git config user.name
}
$command = "git --no-pager log --after=""$($daysBack) days ago"" --pretty=format:""%h - %an, %ar : %s"""
if ($author) {
$command = "$command --author=""$author"""
}
Write-Host $command -ForegroundColor Yellow
$command = "`$output = $command"
Get-ChildItem -Recurse -Depth 2 -Force |
Where-Object { $_.Mode -match "h" -and $_.FullName -like "*\.git" } |
ForEach-Object {
$dir = Get-Item (Join-Path $_.FullName "../")
Push-Location $dir
Invoke-Expression $command
if ($output) {
Write-Host "`n$($dir.Name):" -ForegroundColor Cyan
$output
}
Pop-Location
}
Pop-Location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.