Simplify and fix git command output handling