Hacker News new | ask | show | jobs
by canyonero 1314 days ago
One feature for code search that I've wanted for some time that could unlock some really interesting results would be to allow search to reach into the git file history.

I've found myself sometimes thinking that something existed in a particular codebase and I go to look for only to discover that I'm unable find it. Then, I realize that the code I was looking for has been removed. I can only find it by browsing back into the history figuring out the events that led to the deletion or change. Being able to search the history would be killer IMO.

3 comments

I’ve run into this exact situation multiple times. Searching the whole history would be revolutionary.
FWIW you can do this with Sourcegraph today, searching over both diffs (code changes)[0] and commit messages[1]:

[0] https://sourcegraph.com/search?q=context:global+repo:%5Egith...

[1] https://sourcegraph.com/search?q=context:global+repo:%5Egith...

(I work there, just commenting on my own though. we're all pretty happy to have competition, more awareness of code search, etc.)

Are you familiar with git pickaxe?

For example: git log -pS 'deletedvar'

Thank you for sharing that! TIL.
This is something that I'm working on and I believe a couple of others as well. My solution won't be available until early next year though, as indexing public repos at scale is far from trivial and I'm expecting this will consume over 40TB of fast storage to be performant.