Creates new branch.
`git branch <name>`
(optionaly) `git checkout <name>`

@param $name string
@param $checkout bool

@throws ShellException
@return static
358485
public function createBranch($name, $checkout = false) {
		$this->begin();
		// git branch $name
		$this->run('git branch', $name);
		if($checkout) {
			$this->checkout($name);
		}
		return $this->end();
	}
936414
public static function checkboxSmart($name, $checked = false, $options = [])
    {
        $options['checked'] = (boolean)$checked;
        $value = array_key_exists('value', $options) ? $options['value'] : '1';
        if (isset($options['uncheck'])) {
            // add a hidden field so that if the checkbox is not selected, it still submits a value
            $hidden = static::hiddenInput($name, $options['uncheck']);
            unset($options['uncheck']);
        } else {
            $hidden = '';
        }
        if (isset($options['label'])) {
            $label = $options['label'];
            $labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
            unset($options['label'], $options['labelOptions']);
            $iconOptions = ArrayHelper::remove($options, 'iconOptions', []);
            $iconTag = ArrayHelper::remove($iconOptions, 'tag', 'i');
            $content = static::label(static::input('checkbox', $name, $value, $options) . Html::tag($iconTag, null, $iconOptions) . $label, null, $labelOptions);
            return $hidden . $content;
        } else {
            return $hidden . static::input('checkbox', $name, $value, $options);
        }
    }
405565
protected void gitCreateAndCheckout(final String newBranchName,
            final String fromBranchName) throws MojoFailureException,
            CommandLineException {
        getLog().info(
                "Creating a new branch '" + newBranchName + "' from '"
                        + fromBranchName + "' and checking it out.");

        executeGitCommand("checkout", "-b", newBranchName, fromBranchName);
    }
314873
public function setHead($name, $branch)
    {
        $this->arguments[] = 'set-head';
        $this->arguments[] = $name;
        $this->arguments[] = $branch;
        return $this;
    }
1074666
private function createNode($name)
    {
        $treeBuilder = new TreeBuilder($name);
        if (\method_exists($treeBuilder, 'getRootNode')) {
            $rootNode = $treeBuilder->getRootNode();
        } else {
            $rootNode = $treeBuilder->root($name);
        }

        return $rootNode;
    }
675071
public function getBranch($name)
    {
        return array_key_exists($name, $this->branchesList) ? $this->branchesList[$name] : null;
    }
304035
public function createCheckpoint($name) {
        $checkpoint = microtime(true);
        array_set($this->checkpoints, $name, $checkpoint);

        return $checkpoint;
    }
1307626
public static function create($name, $script)
    {
        if (!self::existe($name)) {
            $name = self::table($name);
            //
            self::$query = 'create table '.$name.'(';
            //
            $object = new self();
            $script($object);
            //
            $query = '';
            //
            for ($i = 0; $i < Collection::count(self::$colmuns); $i++) {
                $query .= ($i == (Collection::count(self::$colmuns) - 1)) ? self::$colmuns[$i] : self::$colmuns[$i].',';
            }
            //
            self::$query .= $query.') DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;';
            //
            return Database::exec(self::$query);
        } else {
            throw new SchemaTableExistsException($name);
        }
    }
261235
public static function buildCustom($name, $extension, $optional = false)
    {
        $returnValue = null;

        
    	// Camelize the name to find it in the checks folder.
        $name = explode('_', $name);
        for ($i = 0; $i < count($name); $i++){
            $name[$i] = ucfirst($name[$i]);
        }
        $name = implode('', $name);
        $checkClassName = "${extension}_install_checks_${name}";
        
        // Instanciate the Component.
        try{
            $checkClass = new ReflectionClass($checkClassName);
            $returnValue = $checkClass->newInstanceArgs(array("custom_${extension}_${name}", $optional));
        }
        catch (LogicException $e){
	        $msg = "Cannot instantiate custom check '${name}' for extension '${extension}': ";
	        $msg .= $e->getMessage();
	        throw new common_configuration_ComponentFactoryException($msg);
        }
        catch (ReflectionException $e){
        	$msg = "Cannot instantiate custom check '${name}' for extension '${extension}': ";
	        $msg .= $e->getMessage();
	        throw new common_configuration_ComponentFactoryException($msg);
        }
        

        return $returnValue;
    }
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))
992148
public function exec($name, $switches = '')
    {

        // Sometimes it is necessary to call a program with sudo
        $attempt_sudo = array_key_exists('sudo_apps', self::$settings) && in_array($name, self::$settings['sudo_apps']);

        // Have we gotten it before?
        if (array_key_exists($name.$switches, $this->cliCache)) {
            return $this->cliCache[$name.$switches];
        }

        // Try finding the exec
        foreach ($this->searchPaths as $path) {

            // Found it; run it
            if (is_file($path.$name) && is_executable($path.$name)) {

                // Complete command, path switches and all
                $command = "$path$name $switches";

                // Sudoing?
                $command = $attempt_sudo ? Common::locateActualPath(Common::arrayAppendString($this->searchPaths, 'sudo', '%2s%1s')).' '.$command : $command;

                // Result of command
                $result = `$command`;

                // Increment call count
                ++self::$callCount;

                // Cache that
                $this->cliCache[$name.$switches] = $result;

                // Give result
                return $result;
            }
        }

        // Never got it
        throw new Exception('Exec `'.$name.'\' not found');
    }
}
698771
public function addCheck(string $name, $check)
    {
        if (array_key_exists($name, $this->checks)) {
            throw new \Exception('Health check with name ' . $name . ' already registered');
        }

        if (!is_callable($check) && !class_exists($check)) {
            throw new \Exception('Health check must be callable object or class name');
        }

        $this->checks[$name] = $check;
    }
410376
def create_branch(version):
    """"""
    repo = Repo.init(".")
    if repo.is_dirty(untracked_files=True):
        raise RuntimeError(f"Repository is dirty, please commit/stash your changes.")

    branch_name = f"release-{version}"
    print(f"{Fore.CYAN}Create {branch_name} branch from upstream master")
    upstream = get_upstream(repo)
    upstream.fetch()
    release_branch = repo.create_head(branch_name, upstream.refs.master, force=True)
    release_branch.checkout()
    return repo
486888
protected function createCheckbox($name, $options)
    {
        $box = new Checkbox($name, $options);
        $box->setAttribute('checked', true)
            ->setAttribute(
                'id',
                preg_replace(
                    array('~\[~', '~\]~', '~--+~', '~-$~'),
                    array('-', '', '-', ''),
                    $name
                )
            );

        return $box;
    }
677014
public static function create($name, callable $callback, ...$arguments) {

        try {

            return  new RpcMethod($name, $callback, ...$arguments);

        } catch (Exception $e) {

            throw $e;

        }

    }
683638
public function create($name)
    {
        $this->checkName($name);

        $configuration = new Configuration();

        $configuration->setName($name);

        $configuration->setModel($this->getParameter($name, 'model'));
        $configuration->setForm($this->getParameter($name, 'form'));
        $configuration->setFormTemplate($this->getParameter($name, 'template.form'));
        $configuration->setRecipientTemplate($this->getParameter($name, 'template.recipient'));
        $configuration->setRecipient($this->getParameter($name, 'recipient'));
        $configuration->setConfirmTemplate($this->getParameter($name, 'template.confirm'));
        $configuration->setPageTemplate($this->getParameter($name, 'template.page'));
        $configuration->setFrom($this->getParameter($name, 'from'));
        $configuration->setSenderName($this->getParameter($name, 'sender_name'));
        $configuration->setSubject($this->getParameter($name, 'subject'));
        $configuration->setTranslationDomain($this->getParameter($name, 'translation_domain'));
        $configuration->setConfirmMail($this->getParameter($name, 'confirm_mail'));

        return $configuration;
    }
1248341
public static function make($name, Closure $callback = null)
    {
        $menu = new self($name);
        if ( ! is_null($callback)) {
            call_user_func($callback, $menu);
        }

        return $menu;
    }