Add a Git tag and push it to origin
517668
def tag(context, name, message=''):
    ""
    # If a tag was provided on the command-line, then add a Git tag and push it to origin
    if name:
        context.run('git tag -a {} -m {!r}'.format(name, message))
        context.run('git push origin {}'.format(name))
260728
public function actionPush()
	{
		$collection = \App::$domain->vendor->info->all();
		Output::pipe('Git push packages');
		foreach($collection as $entity) {
			Output::line($entity->package);
			try {
				Output::line();
				\App::$domain->vendor->git->push($entity);
				Output::line();
			} catch(ShellException $e) {
				Yii::$app->end();
			}
		}
		Output::pipe();
		Output::line();
	}
629256
function gitCommit () {
      var message = options.message
        .replace(/%sourceName%/g, tokens.name)
        .replace(/%sourceCommit%/g, tokens.commit)
        .replace(/%sourceBranch%/g, tokens.branch);

      // If there are no changes, skip commit
      if (shelljs.exec('git status --porcelain', {silent: true}).output === '') {
        log.subhead('No changes to your branch. Skipping commit.');
        return;
      }

      log.subhead('Committing changes to "' + options.branch + '".');
      execWrap('git add -A .');

      // generate commit message
      var commitFile = 'commitFile-' + crypto.createHash('md5').update(message).digest('hex').substring(0, 6);
      fs.writeFileSync(commitFile, message);

      execWrap('git commit --file=' + commitFile);

      fs.unlinkSync(commitFile);
    }
270287
def attach(cls, name, vhost, remote_name):
        """"""
        paas_access = cls.get('paas_access')

        if not paas_access:
            paas_info = cls.info(name)
            paas_access = '%s@%s' \
                          % (paas_info['user'], paas_info['git_server'])

        remote_url = 'ssh+git://%s/%s.git' % (paas_access, vhost)

        ret = cls.execute('git remote add %s %s' % (remote_name, remote_url,))

        if ret:
            cls.echo('Added remote `%s` to your local git repository.'
                     % (remote_name))
            cls.echo('Use `git push %s master` to push your code to the '
                     'instance.' % (remote_name))
            cls.echo('Then `$ gandi deploy` to build and deploy your '
                     'application.')
711498
public function tag($tag)
    {
        $this->sys->exec(sprintf('git tag %s', $tag), 'Unable to create tag');
        $this->sys->exec('git push --tags', 'Unable to push tags');

        return $this;
    }
94083
def git_tag(tag_name, push=False):
    
    with chdir(get_root()):
        result = run_command('git tag -a {} -m "{}"'.format(tag_name, tag_name), capture=True)

        if push:
            if result.code != 0:
                return result
            return run_command('git push origin {}'.format(tag_name), capture=True)

        return result
1301357
def up(context):
    """"""
    context.obj.find_repo_type()
    if context.obj.vc_name == 'git':
        context.obj.call(['git', 'push'])
        context.obj.call(['git', 'push', '--tags'])
    elif context.obj.vc_name == 'hg':
        context.obj.call(['hg', 'push'])
1161371
async function addRemote(name, url) {
  try {
    await exec(`git remote add ${name} ${url}`);
    logger.log(`Added remote to ${name}`);
  } catch (error) {
    throw error;
  }
}
37747
def init_repo(path):
    """"""
    sh("git clone %s %s"%(pages_repo, path))
    here = os.getcwd()
    cd(path)
    sh('git checkout gh-pages')
    cd(here)
174268
function tagRelease(done) {
  fs.readFile(config.pkg, 'utf-8', (err, content) => {
    if (err) {
      done(err);
      return;
    }

    const pkg = JSON.parse(content);
    const version = pkg.version;
    git.tag(`v${version}`, `release: tag version ${version}`, done);
  });
}
423082
def merge(config):
    """"""
    repo = config.repo

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

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

    branch_name = active_branch.name

    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()
    upstream_remote.pull(repo.heads.master)

    repo.git.merge(branch_name)
    repo.git.branch("-d", branch_name)
    success_out("Branch {!r} deleted.".format(branch_name))

    info_out("NOW, you might want to run:\n")
    info_out("git push origin master\n\n")

    push_for_you = input("Run that push? [Y/n] ").lower().strip() != "n"
    if push_for_you:
        upstream_remote.push("master")
        success_out("Current master pushed to {}".format(upstream_remote.name))
713262
def push(self):
        
        print('pushing...')
        push_kwargs = {}
        push_args = []

        if self.settings['push.tags']:
            push_kwargs['push'] = True

        if self.settings['push.all']:
            push_kwargs['all'] = True
        else:
            if '.' in self.remotes:
                self.remotes.remove('.')

                if not self.remotes:
                    # Only local target branches,
                    # `git push` will fail
                    return

            push_args.append(self.remotes)

        try:
            self.git.push(*push_args, **push_kwargs)
            self.pushed = True
        except GitError as error:
            error.message = "`git push` failed"
            raise error
1288060
function createChangelog () {
    start(`Generating changelog from ${oldVersion.cyan} to ${newVersion.cyan}...`);

    exec(`git fetch --tags ${origin}`);
    exec(`git checkout CHANGELOG.md`);
    exec(`gulp changelog --sha=$(git merge-base v${lastMajorVer} HEAD)`);

    done();

    abortCmds.push('git checkout CHANGELOG.md');
    pushCmds.push('git add CHANGELOG.md');
  }
249318
def add_git(meta, git_info):
        """"""
        meta["hexsha"] = git_info.hexsha
        meta["author"] = git_info.author
        meta["email"] = git_info.email
        meta["authored_on"] = git_info.authored_on.isoformat(" ")
273982
function cloneFromGit(hostInfo, root, ssh) {
  const branch = hostInfo.committish ? `-b ${hostInfo.committish}` : '';
  let url;

  if (ssh) {
    url = hostInfo.ssh({noCommittish: true});
  } else {
    url = hostInfo.https({noCommittish: true, noGitPlus: true});
  }

  console.log(`Cloning theme from a git repo: ${chalk.green(url)}`);

  return utils
    .spawn(`git clone ${branch} ${url} "${root}" --single-branch`, {
      stdio: 'pipe',
    })
    .then(() => {
      return fs.remove(path.join(root, '.git'));
    })
    .catch((error) => {
      console.log();
      console.log(chalk.red('There was an error while cloning the git repo:'));
      console.log('');
      console.log(chalk.red(error));

      process.exit(1);
    });
}
527972
def git_fetch(repo_dir, remote=None, refspec=None, verbose=False, tags=True):
    
    command = ['git', 'fetch']
    if not remote:
        command.append('--all')
    else:
        remote = pipes.quote(remote)
    command.extend(['--update-head-ok'])
    if tags:
        command.append('--tags')
    if verbose:
        command.append('--verbose')
    if remote:
        command.append(remote)
    if refspec:
        command.append(refspec)
    return execute_git_command(command, repo_dir=repo_dir)
906896
def push(config, force=False):
    """"""
    repo = config.repo

    active_branch = repo.active_branch
    if active_branch.name == "master":
        error_out(
            "Can't commit when on the master branch. "
            "You really ought to do work in branches."
        )

    state = read(config.configfile)

    if not state.get("FORK_NAME"):
        info_out("Can't help you push the commit. Please run: gg config --help")
        return 0

    try:
        repo.remotes[state["FORK_NAME"]]
    except IndexError:
        error_out("There is no remote called '{}'".format(state["FORK_NAME"]))

    destination = repo.remotes[state["FORK_NAME"]]
    if force:
        pushed, = destination.push(force=True)
        info_out(pushed.summary)
    else:
        pushed, = destination.push()
        # Was it rejected?
        if (
            pushed.flags & git.remote.PushInfo.REJECTED
            or pushed.flags & git.remote.PushInfo.REMOTE_REJECTED
        ):
            error_out('The push was rejected ("{}")'.format(pushed.summary), False)

            try_force_push = input("Try to force push? [Y/n] ").lower().strip()
            if try_force_push not in ("no", "n"):
                pushed, = destination.push(force=True)
                info_out(pushed.summary)
            else:
                return 0