Skip to content

Instantly share code, notes, and snippets.

@thnk2wn
Created May 17, 2019 05:05
Show Gist options
  • Save thnk2wn/a00d0089d2d521d353c834fa05aa1374 to your computer and use it in GitHub Desktop.
Save thnk2wn/a00d0089d2d521d353c834fa05aa1374 to your computer and use it in GitHub Desktop.
[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