promoting execGit to its own func, rather than a closure -- better readability
using `init()` to set up flags
moving file processing into its own func
using defer to flush the output stream