Created
June 9, 2017 18:33
-
-
Save n8v/00ca21b88d4b5a0ae4a8784d46db9e9a to your computer and use it in GitHub Desktop.
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
#!/usr/local/bin/powershell -File | |
<# | |
.EXAMPLE | |
~/scripts/Get-MyCommits.ps1 | pbcopy | |
Commits since 4 am today copied to Mac OS clipboard | |
.EXAMPLE | |
~/scripts/Get-MyCommits.ps1 "5/1" "6/1" "Commits in May" -ShowDates | |
Commits for a whole month | |
#> | |
[CmdletBinding()] | |
param( | |
[Alias('after')] | |
$since = (Get-Date 4:00), | |
[Alias('before')] | |
$until = (Get-Date), | |
$title = "Commits today", | |
[switch] $showDates | |
) | |
# customize these for you and local repos on your machine: | |
$author = '.*Nathan.*' | |
$repos = gi @( | |
'~/ce-psmodule', | |
'~/deploy*' | |
'~/devops' | |
) | |
"## $title" | |
$repos|%{ | |
pushd $_ | |
$repo = $_.Name | |
$repourl = "https://github.com/CareEvolution/$repo" | |
if ($showDates) { | |
$prettydate = "<relative-time title='%ad'>%ar</relative-time> " | |
} | |
$pretty = "- [%h]($repourl/commit/%H) $prettydate %s" | |
$commits = git log --since=$since --until=$until --pretty=$pretty --author=$author --no-merges | |
if ($commits.Count) { | |
"### $($commits.Count) commits to [$repo]($repourl)" | |
$commits | |
"`n" | |
} | |
popd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment