Fix #284: Do not checkout the branch if a commit or PR is specified.

Because of #284, images containing more recent versions of git cannot be used.