Fix order of steps and pass log file to the git prep script

Change-Id: I361ba7fc0827c11509de611841c484e38159f637