Updated status test to be cross-shell compatible.
Disable exiting immediately for branch check.

The failing grep will cause the entire script to exit without disabling
immediate exiting.
Moved tag fetching.

In case $GIT_REV is a tag that hasn't been fetched yet.
Reimplemented git reset --hard.

This will make sure the working copy isn't dirty.
Merge branch 'refresh_branches' into baremetal