Improve formatting of commit msg
Replace literal git/inw calls with vars
Move echo'ing of errors to function
Construct push command only once

Move checking and construction of push command out of main loop so construction
is only done once (push command does not change during script execution.