Update build.sh

Tidy up code
Moved variables to top
Space out segments
Made Git segment more reusable