RFR: Roll back through old versions of a file in git

A feature I really like in some other editors is the ability to roll through old versions of a file 1 by 1. Trying to consider the best way to do that in Kakoune.

define-command git-edit-force 'edit!; nop %sh(git reset -- "$kak_buffile"); git checkout'
alias global ge! git-edit-force

What I am trying to emulate is Glog from fugitive (http://vimcasts.org/episodes/fugitive-vim-exploring-the-history-of-a-git-repository/).

I think it could be done with connect.kak, by reading the output of a shell command to a buffer (if I understand well the vimcast you linked me).

Example – From a connected terminal:

$ git show 'HEAD~2:src/main.cc' | edit [buffer-name]

Example – From Kakoune:

:connect git show "HEAD~2:%val{buffile}" | edit [buffer-name]

It looks like dark magic, but its function is simple: it reads data from stdin and populates a buffer to a session.

@robertmeta https://github.com/isacikgoz/gitin