Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

See also:

    git log -L:funcname:file
funcname will be matched after wrapping it in a "function declaration identifying" regexp.

Get the entire history of a given function (as long as it was in <file>). Not a daily driver, but sometimes unimaginably valuable.



Could you please give a concrete example of how to use funcname? I tried looking in the man page and didn't get it.


I work in C++, so I might be looking for the history of

        Session::set_state (XMLNode const & node)
I would write:

        git log -L:set_state:session_state.cc
If I worked in C, and I had this in a file:

        void
        some_function_name (type1_t t1, type2_t t2)
I would write

        git log -L:some_function_name:thefile.cc


Thanks!

I'll check it and I'll update my article with that!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: