Do a git pull of `ref` from `remote`.
7439
def git_pull(repo_dir, remote="origin", ref=None, update_head_ok=False):
    """"""
    command = ['git', 'pull']
    if update_head_ok:
        command.append('--update-head-ok')
    command.append(pipes.quote(remote))
    if ref:
        command.append(ref)
    return execute_git_command(command, repo_dir=repo_dir)
1347542
def run(self):
        
        args = {"remote": self.remote, "branch": self.branch}
        cmdl = "git pull --ff-only {remote:s} {branch:s}".format(**args)
        try:
            check_call(cmdl.split())
        except CalledProcessError:
            raise SystemExit(1)
        log.info("package version is now {:s}".format(version()))
        return
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.')
714906
def repo_pull(repo_dir, repo_url, fetch=False):
    """"""
    # Make sure the repository is reset to the master branch.
    repo = Repo(repo_dir)
    repo.git.clean("-df")
    repo.git.reset("--hard")
    repo.git.checkout("master")
    repo.head.reset(index=True, working_tree=True)

    # Compile the refspec appropriately to ensure
    # that if the repo is from github it includes
    # all the refs needed, including PR's.
    refspec_list = [
        "+refs/heads/*:refs/remotes/origin/*",
        "+refs/heads/*:refs/heads/*",
        "+refs/tags/*:refs/tags/*"
    ]
    if "github.com" in repo_url:
        refspec_list.extend([
            "+refs/pull/*:refs/remotes/origin/pr/*",
            "+refs/heads/*:refs/remotes/origin/*"])

    # Only get the latest updates if requested.
    if fetch:
        repo.git.fetch(["-u", "-v", "-f",
                        repo_url,
                        refspec_list])
    return repo
1185348
def get_tree_from_branch(self, ref):
        '''
        
        '''
        try:
            return git.RemoteReference(
                self.repo,
                'refs/remotes/origin/{0}'.format(ref)).commit.tree
        except ValueError:
            return None
341756
def _get_ref_info_helper(cls, repo, ref_path):
        """"""
        tokens = None
        repodir = _git_dir(repo, ref_path)
        try:
            with open(osp.join(repodir, ref_path), 'rt') as fp:
                value = fp.read().rstrip()
            # Don't only split on spaces, but on whitespace, which allows to parse lines like
            # 60b64ef992065e2600bfef6187a97f92398a9144                branch 'master' of git-server:/path/to/repo
            tokens = value.split()
            assert(len(tokens) != 0)
        except (OSError, IOError):
            # Probably we are just packed, find our entry in the packed refs file
            # NOTE: We are not a symbolic ref if we are in a packed file, as these
            # are excluded explicitly
            for sha, path in cls._iter_packed_refs(repo):
                if path != ref_path:
                    continue
                # sha will be used
                tokens = sha, path
                break
            # END for each packed ref
        # END handle packed refs
        if tokens is None:
            raise ValueError("Reference at %r does not exist" % ref_path)

        # is it a reference ?
        if tokens[0] == 'ref:':
            return (None, tokens[1])

        # its a commit
        if repo.re_hexsha_only.match(tokens[0]):
            return (tokens[0], None)

        raise ValueError("Failed to parse reference information from %r" % ref_path)
326300
public function pullWithInfo($remote = null) {
		$result = $this->extractFromCommand("git pull $remote", 'trim');
		$result = implode(PHP_EOL, $result);
		$result = trim($result);
		return $result;
	}
298628
def refs(self):
        
        out_refs = IterableList(RemoteReference._id_attribute_, "%s/" % self.name)
        out_refs.extend(RemoteReference.list_items(self.repo, remote=self.name))
        return out_refs
923790
def git_checkout(repo_dir, ref, branch=None):
    
    command = ['git', 'checkout', '--force']
    if branch:
        command.extend(['-B', '{}'.format(branch)])
    command.append(ref)
    return execute_git_command(command, repo_dir=repo_dir)
850168
function clone(git_url, git_ref, clone_dir){
    
    var needsGitCheckout = !!git_ref;
    if (!shell.which('git')) {
        return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
    }

    // If no clone_dir is specified, create a tmp dir which git will clone into.
    var tmp_dir = clone_dir;
    if(!tmp_dir){
        tmp_dir = path.join(os.tmpdir(), 'git', String((new Date()).valueOf()));
    }
    shell.rm('-rf', tmp_dir);
    shell.mkdir('-p', tmp_dir);
    
    var cloneArgs = ['clone'];
    if(!needsGitCheckout) {
        // only get depth of 1 if there is no branch/commit specified
        cloneArgs.push('--depth=1');
    }
    cloneArgs.push(git_url, tmp_dir);
    return superspawn.spawn('git', cloneArgs)
    .then(function() {
        if (needsGitCheckout){
            return superspawn.spawn('git', ['checkout', git_ref], {
                cwd: tmp_dir
            });
        }
    })
    .then(function(){
        events.emit('log', 'Repository "' + git_url + '" checked out to git ref "' + (git_ref || 'master') + '".');
        return tmp_dir;
    })
    .fail(function (err) {
        shell.rm('-rf', tmp_dir);
        return Q.reject(err);
    });
}
59573
def fetch(self, remote=None, refspec=None, verbose=False, tags=True):
        """"""
        return git_fetch(self.repo_dir, remote=remote,
                         refspec=refspec, verbose=verbose, tags=tags)
812683
def get_tree_from_branch(self, ref):
        '''
        
        '''
        try:
            return self.peel(self.repo.lookup_reference(
                'refs/remotes/origin/{0}'.format(ref))).tree
        except KeyError:
            return None
583345
def delete_refs(repo, refs, dry_run=False):
    """"""

    assert isinstance(repo, github.Repository.Repository), type(repo)

    debug("removing {n} refs from {repo}".format(
        n=len(refs),
        repo=repo.full_name)
    )

    for r in refs:
        debug("  deleting {ref}".format(ref=r.ref))
        if dry_run:
            debug('    (noop)')
            continue

        r.delete()
946329
def make_ref(self, branch):
        
        master_sha = self.get_ref(self.master_upstream)
        if not isinstance(master_sha, str):
            return self.ProxyError(
                404,
                "The default branch from which to checkout is either not available or does not exist",
                step="make_ref"
            )

        params = {
          "ref": "refs/heads/{branch}".format(branch=branch),
          "sha": master_sha
        }
        uri = "{api}/repos/{origin}/git/refs".format(
            api=self.github_api_url,
            origin=self.origin
        )
        data = self.request("POST", uri, data=params)

        if data.status_code == 201:
            data = json.loads(data.content.decode("utf-8"))
            return data["object"]["sha"]
        else:
            decoded_data = json.loads(data.content.decode("utf-8"))
            return self.ProxyError(
                data.status_code, (decoded_data, "message"),
                step="make_ref", context={
                    "uri": uri,
                    "params": params
                }
            )
515660
def _get_branch(self, remotes=False):
        '''
        
        '''

        return self.m(
            'getting git branch information',
            cmdd=dict(
                cmd='git branch %s' % ('-r' if remotes else ''),
                cwd=self.local
            ),
            verbose=False
        )
342691
def fetch(self, remote='origin'):
        """"""
        git(self.gitdir, "fetch", remote, _env=self.env())
735536
def get_pull_command(self, remote=None, revision=None):
        """"""
        command = ['hg', 'pull']
        if remote:
            command.append(remote)
        if revision:
            command.append('--rev=%s' % revision)
        return command