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 <[email protected]> | |
4 Brandon Aaron <[email protected]> | |
3 Ariel Flesler <[email protected]> | |
2 jeresig <[email protected]> | |
2 Yehuda Katz <[email protected]> | |
2 Timmy Willison <[email protected]> | |
2 Richard Gibson <[email protected]> | |
1 Yehuda Katz <[email protected]> | |
1 Oleg <[email protected]> | |
1 Jörn Zaefferer <[email protected]> | |
1 David Serduke <[email protected]> | |
1 Anton M <[email protected]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment