Elaborate getting a current working copy.

The `git checkout` step from #3098 got removed by some merge, so here it is again.