As I’m a huge fun of doing the job using keyboard only, I’ve got addicted to VsVim, vim mode using CapsLock, then git console. Unfortunately there were still some actions that were “uncomfortable” like for example investigating “git log“. In order to copy a part of previous commit message or commit id I had to use both mouse and keyboard. Finally I have figured out that the solution is really simple: pipe the result to vim:

git log | vim --noplugin -

- is to tell vim to read from stdin
--noplugin is used to speed up load time and reset some strange behaviour, but you can live without it I think

As it’s not very short, best to have it as console alias:

doskey gl=git log | vim --noplugin -

Here you have some demo:

gif_im_color_dither_16_20a833df54

My journey to figure it out was not that straightforward, as I thought it should be some feature/plugin to my terminal (ConEmu at home, Console2 at work) – nothing found. Then I tried to use VIM as terminal (using ConqueTerm) but not everything worked there (i.e. Yeoman) and finally git commit opened “vim” inside of console in vim … “Vimception” ]:-)>

Finally we can use the same trick in several other places like
git branch – copy branch name for further use in git checkout
git status – copy file name to add/reset/checkout changes
and more…

Advertisements

One thought on “Investigating “git log” without mouse

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s