Find a specific couple of lines of code from large git repo

Posted by mustISignUp on Stack Overflow See other posts from Stack Overflow or by mustISignUp
Published on 2010-04-23T12:04:58Z Indexed on 2010/04/23 12:13 UTC
Read the original article Hit count: 208

Filed under:

So i remember that i once did something in another project and (later removed it), that could be useful now. Thanks to some other SO post i managed to search for a half remembered string..

git grep halfRemeberedNameOfFunction $(git log -g --pretty=format:%h)

and Yay! got some results

2d0bcde:path/to/project/file.c: result = halfRemeberedNameOfFunction( data );
65fc672:path/to/project/file.c: result = halfRemeberedNameOfFunction( data );
24f2858:path/to/project/file.c: result = halfRemeberedNameOfFunction( data );
252e3a5:path/to/project/file.c: result = halfRemeberedNameOfFunction( data, args );
b58bc0b:path/to/project/file.c: result = _halfRemeberedNameOfFunction( data, options );
dce8d9d:path/to/project/file.c: result = halfRemeberedNameOfFunction( data, moreData );

But how do i get that file at one of those revisions?

Many thanks

© Stack Overflow or respective owner

Related posts about git