Skip to content

Instantly share code, notes, and snippets.

@thau0x01
Last active February 21, 2022 18:44
Show Gist options
  • Save thau0x01/473e9974afbacf0cf7542ee86984211f to your computer and use it in GitHub Desktop.
Save thau0x01/473e9974afbacf0cf7542ee86984211f to your computer and use it in GitHub Desktop.
get repository contributors emails

Get all git repository contributors emails

Powershell

Regular Expression that matches e-mail addresses

$re = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|`"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*`")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"

List all contributors of a Git Repository

git log | select-string -pattern $re -All | % { $_.Matches }| % { $_.Value } | Sort-Object | Get-Unique

Bash

Thx to @carlosevieira

git log | grep Author | cut -d '<' -f2 | cut -d '>' -f1 | sort | uniq  | grep "@"
@carlosevieira
Copy link

carlosevieira commented Feb 21, 2022

On linux:

git log | grep Author | cut -d '<' -f2 | cut -d '>' -f1 | sort | uniq  | grep "@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment