Goes back to the master branch, deletes the current branch locally
    and remotely.
9432
def getback(config, force=False):
    """"""
    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
    fork_remote = None
    for remote in repo.remotes:
        if remote.name == origin_name:
            # remote.pull()
            upstream_remote = remote
            break
    if not upstream_remote:
        error_out("No remote called {!r} found".format(origin_name))

    # Check out master
    repo.heads.master.checkout()
    upstream_remote.pull(repo.heads.master)

    # Is this one of the merged branches?!
    # XXX I don't know how to do this "natively" with GitPython.
    merged_branches = [
        x.strip()
        for x in repo.git.branch("--merged").splitlines()
        if x.strip() and not x.strip().startswith("*")
    ]
    was_merged = branch_name in merged_branches
    certain = was_merged or force
    if not certain:
        # Need to ask the user.
        # XXX This is where we could get smart and compare this branch
        # with the master.
        certain = (
            input("Are you certain {} is actually merged? [Y/n] ".format(branch_name))
            .lower()
            .strip()
            != "n"
        )
    if not certain:
        return 1

    if was_merged:
        repo.git.branch("-d", branch_name)
    else:
        repo.git.branch("-D", branch_name)

    fork_remote = None
    for remote in repo.remotes:
        if remote.name == state.get("FORK_NAME"):
            fork_remote = remote
            break
    if fork_remote:
        fork_remote.push(":" + branch_name)
        info_out("Remote branch on fork deleted too.")
2560
def clean_remotes
      protected_remotes = remotes_for_branches
      remotes.each do |remote|
        # Only remove review remotes that aren't referenced by current branches.
        if remote.index('review_') == 0 && !protected_remotes.include?(remote)
          git_call "remote remove #{remote}"
        end
      end
    end
516219
def clear():
    
    utils.check_for_local_server()
    click.confirm(
        "Are you sure you want to do this? It will delete all of your data",
        abort=True
    )
    server = Server(config["local_server"]["url"])
    for db_name in all_dbs:
        del server[db_name]
381831
void undoLocalChanges() {

        workspaceProvider.synchronizedOperation(new Callable<Void>() {
            @Override
            public Void call() {
                try {
                    LOGGER.info("Undo local changes due to failure of git operations");
                    try {
                        git.rebase().setOperation(RebaseCommand.Operation.ABORT).call();
                    } catch (WrongRepositoryStateException e) {
                        // ignore rebasing exception when in wrong state
                    }
                    final String remoteBranch = Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + '/' + git.getRepository().getBranch();
                    git.reset().setMode(ResetType.HARD).setRef(remoteBranch).call();
                    git.clean().setCleanDirectories(true).call();
                    try {
                        final ObjectId head = git.getRepository().resolve(Constants.HEAD);
                        LOGGER.info("Undo local changes completed. HEAD is " + head.getName());
                    } catch (final Exception e) {
                        LOGGER.warn("Failed to fetch HEAD", e);
                    }
                } catch (final Exception e) {
                    LOGGER.error("Unable to undo changes", e);
                }
                return null;
            }
        });
    }
1065927
function () {
      gutil.log('Pushing ' + chalk.magenta(folder) + ' to ' + chalk.cyan(remote) + '/' + chalk.cyan(branch));
      execute('git subtree push --prefix ' + folder + ' ' + remote + ' ' + branch, function (error) {
        if (error) {
          return cb(error);
        }
        gutil.log('Resetting ' + chalk.magenta(folder) + ' temporary commit');
        execute('git reset HEAD^', function (error) {
          return cb(error, file);
        });
      });
    }
138221
def remote_delete(self, remote_path, r_st):
        """"""
        # If it's a directory, then delete content and directory
        if S_ISDIR(r_st.st_mode):
            for item in self.sftp.listdir_attr(remote_path):
                full_path = path_join(remote_path, item.filename)
                self.remote_delete(full_path, item)
            self.sftp.rmdir(remote_path)

        # Or simply delete files
        else:
            try:
                self.sftp.remove(remote_path)
            except FileNotFoundError as e:
                self.logger.error(
                    "error while removing {}. trace: {}".format(remote_path, e)
                )
751179
def delete(self):
        """"""
        try:
            self.revert()
        except errors.ChangelistError:
            pass

        self._connection.run(['change', '-d', str(self._change)])
70604
def checkout(repo, ref):
    """"""
    # Delete local branch if it exists, remote branch will be tracked
    # automatically. This prevents stale local branches from causing problems.
    # It also avoids problems with appending origin/ to refs as that doesn't
    # work with tags, SHAs, and upstreams not called origin.
    if ref in repo.branches:
        # eg delete master but leave origin/master
        log.warn("Removing local branch {b} for repo {r}".format(b=ref,
                                                                 r=repo))
        # Can't delete currently checked out branch, so make sure head is
        # detached before deleting.

        repo.head.reset(index=True, working_tree=True)
        repo.git.checkout(repo.head.commit.hexsha)
        repo.delete_head(ref, '--force')

    log.info("Checkout out repo {repo} to ref {ref}".format(repo=repo,
                                                            ref=ref))
    repo.head.reset(index=True, working_tree=True)
    repo.git.checkout(ref)
    repo.head.reset(index=True, working_tree=True)
    sha = repo.head.commit.hexsha
    log.info("Current SHA for repo {repo} is {sha}".format(repo=repo, sha=sha))
807936
public void close() {
        if (transactionalBranch != null) {
            XATransactionalBranch<C> branch= this.transactionalBranch;
            this.release();
            branch.getManagedConnection().close();
        }

    }
922101
def revert(self, snapshot: Tuple[Hash32, UUID]) -> None:
        
        state_root, account_snapshot = snapshot

        # first revert the database state root.
        self._account_db.state_root = state_root
        # now roll the underlying database back
        self._account_db.discard(account_snapshot)
575486
def unpublish_branch(self, branch):
        """"""

        try:
            return self.git_exec(
                ['push', self.remote.name, ':{0}'.format(branch)])
        except GitCommandError:
            _, _, log = self.git_exec(
                ['fetch', self.remote.name, '--prune'],
                with_extended_output=True)
            abort('Unpublish failed. Fetching.', log=log, type='unpublish')
371512
def abort_cherry_pick(self):
        
        if self.initial_state != WORKFLOW_STATES.BACKPORT_PAUSED:
            raise ValueError("One can only abort a paused process.")

        cmd = ["git", "cherry-pick", "--abort"]
        try:
            set_state(WORKFLOW_STATES.ABORTING)
            self.run_cmd(cmd)
            set_state(WORKFLOW_STATES.ABORTED)
        except subprocess.CalledProcessError as cpe:
            click.echo(cpe.output)
            set_state(WORKFLOW_STATES.ABORTING_FAILED)
        # only delete backport branch created by cherry_picker.py
        if get_current_branch().startswith("backport-"):
            self.cleanup_branch(get_current_branch())

        reset_stored_config_ref()
        reset_state()
807892
def clean_remote
      to_delete = remote_assets - local_compiled_assets
      to_delete.each do |f|
        delete_remote_asset(bucket.files.get(f))
      end
    end
1341037
def delete(self):
        
        if self.exists:
            logger.info("Deleting %s" % self.path)
            shutil.rmtree(self.path)
838944
def branch(self, name, desc=None):
        
        return Local.new(path=os.path.join(self.path, name), desc=desc, bare=True)
511801
def uninstall(client):
    """"""
    from git.index.fun import hook_path as get_hook_path

    for hook in HOOKS:
        hook_path = Path(get_hook_path(hook, client.repo.git_dir))
        if hook_path.exists():
            hook_path.unlink()
929521
protected void release() {
		stack.getLocalTransactions().remove(Integer.valueOf(localTID));
		stack.getRemoteTxToLocalTxMap().remove(Integer.valueOf(remoteTID));
		cancelTHISTTimerTask();
		cancelLongtranTimer();
		cancelReTransmissionTimer();
		
		if(originalPacket!=null)
			stack.releasePacket(originalPacket);
		
		originalPacket=null;
	}