implement --print-git-commands option
refactor and simplify git output handling