This is useful for searching diffs. If your repo is small this is quite fast. However for large repos, it can be slow which is why I use my own diffs indexer. Below is a screenshot of what my diffs search looks like.
As well, -S<string> only shows patches where the diff changes the number of occurrences of <string>. Thus if a patch both adds and removes <string>, it won't be shown by -S. -G<pattern> will show any patches where <pattern> occurs in the diff at all.
Sorry about that. I just looked for -S as that's all that I ever use for performance reasons, but you are correct as you do mention a diff search example.
Very interesting. If you haven't tried grepping the files in your git repository (as opposed to using regular `grep` or your editor's search function, which doesn't ignore files outside version control), it's surprisingly powerful.
I wasn't aware that `git grep` was as customizable as is shown in the article. I tend to use `ag` (the silver searcher) instead of regular grep, which besides being fast produces nice colored output. Here's a `zsh` function I put into my ~/.zshrc which allows me to apply ag only to files tracked by git: https://gist.github.com/pesterhazy/9294048
It looks like the author used BSD grep on OSX (despite linking to FSF) which explains the dogshit performance of grep. If you use a mac install grep from Homebrew with the `--default-names` option.
Speaking of Homebrew – is there a way to get it installed on Mac OS without an Apple ID?
I got this fancy shiny Macbook (with a broken keyboard, but who cares…) from IT and it might actually make sense to use it sometimes, but I don’t really want to go through the hassle of registering with Apple just to get a recent-ish Bash, git etc. The instructions on the website seem to require Xcode to be installed, which seems to only be available via iTunes.
Yes you'll need an Apple ID to get XCode and other Apple updates. Very annoying but for quite a few software programs, there's not much choice than to go through the dreadful App Store application.
Yeah, but running it in a Virtualbox is not quite the same and I don’t think IT would let me install it directly on the HDD (even though all the workstations run Ubuntu).
It gives at least one non-obvious thing - grouping searches like ack. It gives a number of practical examples, explains git diff-index, and a number of other git commands that aren't that well known. Then it explains how to integrate ack into your editor.
Slightly tangential, but related: on windows, Agent Ransack is an awesome program for searching through files/directories. It has a great UI, is quite fast, and has all the features you could want (regexes on filename and/or file contents, search history, etc). It is really helpful for doing quick lookups to see where methods/classes/variables are being used in the codebase.
Are ninjas known for being good at software engineering? Are Rockstars, for that matter? I think these terms have replaced "like a pro" and other such turns-of-phrase that were once common.
By which they mean, "Leaving the repository owner bleeding out from a cut carotid artery, never knowing what happened to them?"
Didn't we make a pact to stop using "ninja" and "rock star"? Excepting, of course, an interviewee who a) arrives in the conference room via the air ducts while the the interview's back is turned, or b) who snorts lines of coke off the whiteboard tray and then smashes holes in the sheetrock walls with a Fender Stratocaster.
git log -S"pattern"
This is useful for searching diffs. If your repo is small this is quite fast. However for large repos, it can be slow which is why I use my own diffs indexer. Below is a screenshot of what my diffs search looks like.
http://screenshots.gitsense.com/diffs-search.html
For most people, git log -S should work fine but my solution is targeted for enterprise, which is why I went my own route.