Created
February 16, 2023 08:05
-
-
Save matthewjberger/26d289ee1439b1d9dfb399086cf88502 to your computer and use it in GitHub Desktop.
Get the commit for a specific user that added more lines than all other commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --shortstat --author="Matthew J. Berger" --pretty=format:"%H - %an, %ar : %s" | foreach { | |
if ($_ -match '([0-9a-fA-F]{40})') { | |
$commitHash = $matches[1] | |
} | |
if ($_ -match '(\d+)\s+insertion\S*.*(\d+)\s+deletion\S*') { | |
$insertions = [int]$matches[1] | |
$deletions = [int]$matches[2] | |
[pscustomobject]@{ | |
CommitHash = $commitHash | |
Insertions = $insertions | |
Deletions = $deletions | |
LineCount = $insertions - $deletions | |
CommitInfo = $_ | |
} | |
} | |
} | Sort-Object LineCount -Descending | Select-Object -First 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment