Do a git pull of `ref` from `remote`.
324530
def pull(self, remote="origin", ref=None):
        """"""
        return git_pull(self.repo_dir, remote=remote, ref=ref)
1150966
def pull(self):
        
        if not os.path.exists(self.repo_dir):
            yield from self.initialize_repo()
        else:
            yield from self.update()
1081454
def set_up_clone(self, repo_name, remote_repo):
        """"""
        dirname = self.clone_dir(repo_name)
        self.to_cleanup[repo_name] = dirname
        klass = self.get_repo_class()
        repo = klass(repo_name,
                     dirname,
                     self.tools,
                     self.executor,
                     shallow=self.shallow_clone)
        return (dirname, repo)
230282
def clone_repo(self):
        """"""
        tempdir_path = tempfile.mkdtemp()

        if self.args.git:
            self.log.debug('Cloning git source repository from %s to %s',
                           self.source, tempdir_path)
            self.sh('git clone', self.source, tempdir_path)

        else:
            raise NotImplementedError('Unknown repo type')

        self.source = tempdir_path
704678
def clone(self, repo, ref, deps=()):
        """"""

        if os.path.isdir(repo):
            repo = os.path.abspath(repo)

        def clone_strategy(directory):
            env = git.no_git_env()

            def _git_cmd(*args):
                cmd_output('git', *args, cwd=directory, env=env)

            _git_cmd('init', '.')
            _git_cmd('remote', 'add', 'origin', repo)

            try:
                self._shallow_clone(ref, _git_cmd)
            except CalledProcessError:
                self._complete_clone(ref, _git_cmd)

        return self._new_repo(repo, ref, deps, clone_strategy)
1060974
def clone_repo(pkg, dest, repo, repo_dest, branch):
    """"""
    git(['clone', '--recursive', '-b', branch, repo, repo_dest])
615351
def _shallow_clone(self, ref, git_cmd):  # pragma: windows no cover
        

        git_config = 'protocol.version=2'
        git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
        git_cmd('checkout', ref)
        git_cmd(
            '-c', git_config, 'submodule', 'update', '--init',
            '--recursive', '--depth=1',
        )
424193
function cloneGitRepo(host, ref) {
    var isBranch = false;

    ref = ref || 'master';
    if (!validateSha(ref)) isBranch = true;

    return Q()

    // Create temporary folder to store git repos
    .then(function() {
        if (GIT_TMP) return;
        return fs.tmp.dir()
            .then(function(_tmp) {
                GIT_TMP = _tmp;
            });
    })

    // Return or clone the git repo
    .then(function() {
        // Unique ID for repo/ref combinaison
        var repoId = crc.crc32(host+'#'+ref).toString(16);

        // Absolute path to the folder
        var repoPath = path.resolve(GIT_TMP, repoId);

        return fs.exists(repoPath)
            .then(function(doExists) {
                if (doExists) return;

                // Clone repo
                return exec('git clone '+host+' '+repoPath)
                .then(function() {
                    return exec('git checkout '+ref, { cwd: repoPath });
                });
            })
            .thenResolve(repoPath);
    });
}
113846
def pull(self, remote, branch=None):
        '''
        '''
        pb = ProgressBar()
        pb.setup(self.name)
        if branch:
            remote.pull(branch, progress=pb)
        else: # pragma: no cover
            remote.pull(progress=pb)
        print()
1171579
def remote_ref(self):
        
        # translate heads to a local remote, tags stay as they are
        if self.remote_ref_string.startswith("refs/tags"):
            return TagReference(self._remote.repo, self.remote_ref_string)
        elif self.remote_ref_string.startswith("refs/heads"):
            remote_ref = Reference(self._remote.repo, self.remote_ref_string)
            return RemoteReference(self._remote.repo, "refs/remotes/%s/%s" % (str(self._remote), remote_ref.name))
        else:
            raise ValueError("Could not handle remote ref: %r" % self.remote_ref_string)
1364943
def get_branches(self, local=True, remote_branches=True):
        """"""

        if not self.repo.remotes:
            remote_branches = False

        branches = []

        if remote_branches:

            # Remote refs.
            try:
                for b in self.remote.refs:
                    name = '/'.join(b.name.split('/')[1:])

                    if name not in legit_settings.forbidden_branches:
                        branches.append(Branch(name, is_published=True))
            except (IndexError, AssertionError):
                pass

        if local:

            # Local refs.
            for b in [h.name for h in self.repo.heads]:

                if (not remote_branches) or (b not in [br.name for br in branches]):
                    if b not in legit_settings.forbidden_branches:
                        branches.append(Branch(b, is_published=False))

        return sorted(branches, key=attrgetter('name'))
252921
def _get_ref(repo, name):
    '''
    
    '''
    if name == 'base':
        name = repo['base']
    if name == repo['base'] or name in envs():
        if repo['branch_method'] == 'branches':
            return _get_branch(repo['repo'], name) \
                or _get_tag(repo['repo'], name)
        elif repo['branch_method'] == 'bookmarks':
            return _get_bookmark(repo['repo'], name) \
                or _get_tag(repo['repo'], name)
        elif repo['branch_method'] == 'mixed':
            return _get_branch(repo['repo'], name) \
                or _get_bookmark(repo['repo'], name) \
                or _get_tag(repo['repo'], name)
    return False
241395
def get_git_ref(self, ref):
        
        prefix = "/git/refs/"
        if not self._requester.FIX_REPO_GET_GIT_REF:
            prefix = "/git/"
        assert isinstance(ref, (str, unicode)), ref
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + prefix + ref
        )
        return github.GitRef.GitRef(self._requester, headers, data, completed=True)
121603
def pull_repo(repo_name):
    """"""
    repo = ClonedRepo.objects.get(pk=repo_name)
    repo.pull()
537309
def pull(self, remote: _PATH, local: _PATH) -> None:
        ''''''
        output, _ = self._execute('-s', self.device_sn, 'pull', remote, local)
        if 'error' in output:
            raise FileNotFoundError(f'Remote {remote!r} does not exist.')
1025074
def delete(cls, repo, *refs, **kwargs):
        """"""
        repo.git.branch("-d", "-r", *refs)
        # the official deletion method will ignore remote symbolic refs - these
        # are generally ignored in the refs/ folder. We don't though
        # and delete remainders manually
        for ref in refs:
            try:
                os.remove(osp.join(repo.common_dir, ref.path))
            except OSError:
                pass
            try:
                os.remove(osp.join(repo.git_dir, ref.path))
            except OSError:
                pass
531680
def rebase(config):
    """"""
    repo = config.repo

    active_branch = repo.active_branch
    if active_branch.name == "master":
        error_out("You're already on the master branch.")
    active_branch_name = active_branch.name

    if repo.is_dirty():
        error_out(
            'Repo is "dirty". ({})'.format(
                ", ".join([repr(x.b_path) for x in repo.index.diff(None)])
            )
        )

    state = read(config.configfile)
    origin_name = state.get("ORIGIN_NAME", "origin")
    upstream_remote = None
    for remote in repo.remotes:
        if remote.name == origin_name:
            upstream_remote = remote
            break
    if not upstream_remote:
        error_out("No remote called {!r} found".format(origin_name))

    repo.heads.master.checkout()
    repo.remotes[origin_name].pull("master")

    repo.heads[active_branch_name].checkout()

    print(repo.git.rebase("master"))
    success_out("Rebased against {}/master".format(origin_name))
    info_out("If you wanto start interactive rebase run:\n\n\tgit rebase -i master\n")