refactored the git checkout code