At work, I use Emacs (nowadays with the Spacemacs configuration). My favorite Git history browser is tig. When I want to see the git history or blame for the file I’m currently editing, what do I do?
There are many possible solutions, but here’s mine: a small script
called cur
that returns the path to the buffer currently active in
Emacs.
#!/bin/sh
emacsclient -e '(buffer-file-name (window-buffer))' | \
sed -e 's/^"//' -e 's/"$//'
It’s easy to use with tig – or any other command-line tool you might need:
tig blame $(cur)