Skip to content

Instantly share code, notes, and snippets.

@x3ro
Created November 25, 2015 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x3ro/96d582273e32abbdc690 to your computer and use it in GitHub Desktop.
Save x3ro/96d582273e32abbdc690 to your computer and use it in GitHub Desktop.
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