made the script compilable, added error checking for initial git command