Skip to content

Instantly share code, notes, and snippets.

@x3ro x3ro/git-foobar.sh
Created Nov 25, 2015

Embed
What would you like to do?
Script which shows other commits that touch a file introduced by the given commit
# Didn't find a good name for this yet :D
function git-foobar {
COMMITS=$(git diff-tree --no-commit-id --name-only -r --diff-filter=A $1 | \
xargs git log --pretty="%H" -- | \
uniq | \
grep --invert-match $(git rev-parse $1))
if (( $(echo -n "$COMMITS" | wc -l) > 0 )); then
echo "$COMMITS" | xargs git show --stat
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.