Initial implementation. Untested.
Fixed behavior after testing on grgit.

Tested the plugin on grgit, and it is working on that codebase.