Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created May 3, 2014 05:12
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 legumbre/38c78887110502dbdc4d to your computer and use it in GitHub Desktop.
Save legumbre/38c78887110502dbdc4d to your computer and use it in GitHub Desktop.
find commit containing blob with hash
#!/bin/sh
obj_name="$1"
shift
git log "$@" --pretty=format:'%T %h %s' \
| while read tree commit subject ; do
if git ls-tree -r $tree | grep -q "$obj_name" ; then
echo $commit "$subject"
fi
done
#
# ./findcommitforblob deadbeef master
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment