# File lib/capistrano/recipes/deploy/scm/git.rb, line 132
        def checkout(revision, destination)
          git    = command
          remote = origin

          args = []
          args << "-o #{remote}" unless remote == 'origin'
          if depth = configuration[:git_shallow_clone]
            args << "--depth #{depth}"
          end

          execute = []
          if args.empty?
            execute << "#{git} clone #{configuration[:repository]} #{destination}"
          else
            execute << "#{git} clone #{args.join(' ')} #{configuration[:repository]} #{destination}"
          end

          # checkout into a local branch rather than a detached HEAD
          execute << "cd #{destination} && #{git} checkout -b deploy #{revision}"
          
          if configuration[:git_enable_submodules]
            execute << "#{git} submodule init"
            execute << "#{git} submodule update"
          end

          execute.join(" && ")
        end