checkout ref when reached

when next_commit is empty (means target has been reached), set the 'checkout target' to be the ref, rather than sha
Merge pull request #3 from jasonkarns/patch-1

checkout ref when reached