Wouldn’t it be great if you could find all the changes to a line in your entire history? Sort of like git blame, but only for revisions that match some string. This is where git’s pickaxe functionality comes in.
git log, git diff, and git format-patch all can use the pickaxe.
To use the pickaxe, just pass the -S option. git log -Sgit-diff --pretty=oneline --abbrev-commit run on the git repository outputs this:
497c833... Documentation: convert "glossary" and "core-tutorial" to man pages b27a23e... Documentation: convert tutorials to man pages 0e36f2d... git-p4: Removed git-p4 submit --direct. 2cd5dfd... Teach git-grep --name-only as synonym for -l 87f1b88... mailinfo: feed only one line to handle_filter() for QP input fdcf39e... Include rev-list options in git-log manpage. 8b30aa5... git.el: Support for getting diffs from inside the log-edit buffer. e25cfae... contrib: resurrect scripted git-revert. 530e741... Start preparing the API documents. 18ff365... git.el: Added a menu for git-status-mode. cc2d6b8... don't mention index refreshing side effect in git-status docs 272bd3c... Include diff options in the git-log manpage 61fd255... gitweb: Update and improve gitweb/README file 79d3066... Consolidate command list to one. 8b014d7... git-svn: info --url [path] e6fefa9... git-svn info: implement info command 5b98d9b... user-manual: mention "..." in "Generating diffs", etc. c1a95fa... Documentation: customize diff-options depending on particular command b43b0a3... git-p4: Add a helper function to parse the full git diff-tree output. 9e6c723... git-diff.txt: add section "output format" describing the diff formats 6b6012e... cvsexportcommit: fix for commits that do not have parents 0cec6db... gitweb: Fix and simplify "split patch" detection 0995520... Document additional 1.5.3.5 fixes in release notes
Because tig supports all the git options, running tig -Sgit-diff shows you the list of commits and lets you see the diffs by hitting enter.
The pickaxe can help find code that’s been deleted or moved, git blame won’t tell you about those lines at all. Any time you want to find out more about a piece of code than just who touched it last, the pickaxe is a good little tool to reach for.
References:

No comments yet
Comments feed for this article