DEV Community

Caleb Hearth
Caleb Hearth

Posted on • Originally published at calebhearth.com on

Ask Git to Show a Method

If you enjoy this article on Git, also check these other Git tips:

When coding, I often find myself wanting to quickly check the details of a function or method related to what I’m working on. For instance, I might need to understand how the function handles its arguments or recall its side effects.

If you just want to know how to do this, you can jump down and skip my story.

I usually use ctags with Vim for this. A quick ], a brief read, and a <Ctrl-o> and I’m back from whence I came and more informed for my effort. Still, sometimes would be more convenient to just have the code printed right to my terminal from the command line.

If you’re here, you might remember that we previously looked at Git’s ability to walk the history of a specific method using git log -L1. What you might not know is that git log and git show are close siblings—actually defined in the same file.

Read More

Top comments (0)