diff --git a/skills/git-control/SKILL.md b/skills/git-control/SKILL.md index 9005362..b4046b2 100644 --- a/skills/git-control/SKILL.md +++ b/skills/git-control/SKILL.md @@ -100,7 +100,7 @@ Analyze differences between branches to find commits that need merging (e.g. pro .\scripts\branch_compare.ps1 -RepoPath "d:\path\to\repo" -CompareSet full -SinceDate "2025-01-01" ``` -**Output**: Commits in `HeadBranch` NOT in `BaseBranch` = need to merge (hotfixes). Commits in `BaseBranch` NOT in `HeadBranch` = base is ahead (normal). +**Output**: Each line shows `hash | author | message`. When there are unmerged commits, a "By user (unmerged)" summary lists each user and their commit count. ### 7. Org-Wide User Access diff --git a/skills/git-control/scripts/branch_compare.ps1 b/skills/git-control/scripts/branch_compare.ps1 index 83d218e..9d68fbb 100644 --- a/skills/git-control/scripts/branch_compare.ps1 +++ b/skills/git-control/scripts/branch_compare.ps1 @@ -26,7 +26,7 @@ if (-not $ApiToken -and (Test-Path $ConfigPath)) { function Get-GitLog { param([string]$Path, [string]$Range, [string]$Since) - $gitArgs = @("log", $Range, "--oneline", "--no-merges") + $gitArgs = @("log", $Range, "--no-merges", "--format=%h | %an | %s") if ($Since) { $gitArgs += "--since=$Since" } $out = & git -C $Path $gitArgs 2>&1 if ($out) { $out } else { @() } @@ -65,6 +65,13 @@ function Compare-Local { Write-Host " Total: $($inBaseNotHead.Count) commits" -ForegroundColor Gray } if ($inHeadNotBase.Count -gt 0) { + $byUser = $inHeadNotBase | ForEach-Object { + $parts = $_ -split '\s*\|\s*' + if ($parts.Count -ge 2) { $parts[1].Trim() } + } | Where-Object { $_ } | Group-Object | Sort-Object Count -Descending + Write-Host "" + Write-Host "By user (unmerged):" -ForegroundColor Yellow + $byUser | ForEach-Object { Write-Host " $($_.Name): $($_.Count) commits" } Write-Host "" Write-Host "ACTION: Merge ${HeadBranch} into ${BaseBranch} to sync hotfixes." -ForegroundColor Red } @@ -86,7 +93,11 @@ function Compare-API { if ($commits.Count -eq 0) { Write-Host " (none)" -ForegroundColor Green } else { - $commits | ForEach-Object { Write-Host " $($_.sha.Substring(0,7)) $($_.commit.message.Split("`n")[0])" } + $commits | ForEach-Object { + $author = $_.commit.author.name + if ($_.author.login) { $author = $_.author.login } + Write-Host " $($_.sha.Substring(0,7)) | $author | $($_.commit.message.Split("`n")[0])" + } Write-Host " Total: $($commits.Count) commits" -ForegroundColor Yellow } Write-Host "" @@ -97,10 +108,20 @@ function Compare-API { if ($commitsRev.Count -eq 0) { Write-Host " (none)" -ForegroundColor Gray } else { - $commitsRev | ForEach-Object { Write-Host " $($_.sha.Substring(0,7)) $($_.commit.message.Split("`n")[0])" } + $commitsRev | ForEach-Object { + $author = $_.commit.author.name + if ($_.author.login) { $author = $_.author.login } + Write-Host " $($_.sha.Substring(0,7)) | $author | $($_.commit.message.Split("`n")[0])" + } Write-Host " Total: $($commitsRev.Count) commits" -ForegroundColor Gray } if ($commits.Count -gt 0) { + $byUser = $commits | ForEach-Object { + if ($_.author.login) { $_.author.login } else { $_.commit.author.name } + } | Group-Object | Sort-Object Count -Descending + Write-Host "" + Write-Host "By user (unmerged):" -ForegroundColor Yellow + $byUser | ForEach-Object { Write-Host " $($_.Name): $($_.Count) commits" } Write-Host "" Write-Host "ACTION: Merge ${HeadBranch} into ${BaseBranch} to sync hotfixes." -ForegroundColor Red }