Last active
February 21, 2024 11:50
-
-
Save padolsey/8820458 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
function git_likely_authority() { | |
# Outputs a ranked list of likely author(itie)s regarding tracked files matching *${1}* | |
# (Makes it easier to discover who likely knows most about the matched files) | |
# (Note: Not always indicative if large refactors/renamings have occurred) | |
# E.g. `git_likely_authority some_pattern_that_matches_a_path` | |
git ls-files "*${1}*" | | |
grep -v -E 'node_modules|vendor' | # edit to avoid certain files/dirs | |
xargs -n1 git blame --line-porcelain | | |
sed -n 's/^author //p' | | |
sort -f | | |
uniq -ic | | |
sort -nr | |
} | |
function git_blame_string() { | |
# Outputs a ranked list of authors that introduce or removed the given <string> | |
# E.g. `git_blame_word SomeFunctionName` | |
git log -S"${1}" --stat | sed -n 's/^Author: //p' | sort -f | uniq -ic | sort -nr | |
} |
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
➜ jquery git:(master) git_blame_string toggleClass | |
14 John Resig <jeresig@gmail.com> | |
4 Brandon Aaron <brandon.aaron@gmail.com> | |
3 Ariel Flesler <aflesler@gmail.com> | |
2 jeresig <jeresig@gmail.com> | |
2 Yehuda Katz <wycats@Yehuda-Katz.local> | |
2 Timmy Willison <timmywillisn@gmail.com> | |
2 Richard Gibson <richard.gibson@gmail.com> | |
1 Yehuda Katz <wycats@gmail.com> | |
1 Oleg <markelog@gmail.com> | |
1 Jörn Zaefferer <joern.zaefferer@gmail.com> | |
1 David Serduke <davidserduke@gmail.com> | |
1 Anton M <obhvsbypqghgc@gmail.com> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment