% git-find-blob (faster) % Michael Stone % March 17, 2012 Presently, Google's index seems to know [three][] [different][] [answers][] to the question: "how do I find the (git) commit that introduced blob X?"; however, all three answers solve the problem with O(N) processes, which is slow. A better solution, using only O(1) processes (and O(1) memory?) looks like this: HASH=$(git hash-object -t blob /path/to/blob/to/find.c) git log --pretty=oneline --diff-filter=A --raw --abbrev=40 \ | grep -e '^[^:]' -e $HASH \ | grep -B 1 '^:' Can you do better? [three]: http://stackoverflow.com/questions/460331/git-finding-a-filename-from-a-sha1 [different]: https://github.com/jwiegley/git-scripts/blob/master/git-find-blob [answers]: http://ebnj.net/gittips/