Created
February 28, 2019 02:24
-
-
Save sebastianwebber/776143cbb951fdc2dae96590212f96be to your computer and use it in GitHub Desktop.
find YOUR git history amoung lots of git repositories
This file contains hidden or 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
## include on your .zshrc (or similar) | |
#### tested on OSX | |
function findGitHistory() { | |
targetDir="${1}" | |
targetMonth="${2}" | |
targetYear="${3}" | |
targetUser=$(git config --get user.name) | |
[[ "${targetDir}X" = "X" ]] && targetMonth=$(pwd) | |
[[ "${targetMonth}X" = "X" ]] && targetMonth=$(date +"%b") | |
[[ "${targetYear}X" = "X" ]] && targetYear=$(date +"%Y") | |
for repo in $(find "${targetDir}" -type d -name \.git | xargs -n 1 dirname ); do | |
echo repo_dir: $repo | |
cd $repo | |
git log --pretty=format:"%h - %an, %ad : %s" | grep "${targetUser}" | grep "${targetMonth}" | grep "${targetYear}" 2>/dev/null | |
done | most | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
parece ter um bug na linha 11, não deveria ser "... && targetDir=$(pwd)" ???