LinuxCommandLibrary

git-create-branch

Create and optionally switch to new branch

TLDR

Create and switch to branch

$ git create-branch [branch_name]
copy
Create from specific commit
$ git create-branch [name] [commit]
copy
Create without switching
$ git create-branch -r [name]
copy

SYNOPSIS

git create-branch [options] name [commit]

DESCRIPTION

git create-branch is a convenience command from git-extras that simplifies branch creation workflows. It creates a new branch, optionally switches to it, and can immediately push it to the remote repository in a single operation.
Without the -r flag, the command creates a local branch and switches to it, equivalent to git checkout -b. With the -r flag, it creates the branch, pushes it to origin, and sets up tracking, combining several manual steps into one command.
You can optionally specify a starting commit hash or branch name; otherwise, the branch starts from HEAD. This streamlines common workflows like starting feature branches or creating release branches that need immediate remote visibility.

PARAMETERS

-r, --remote

Create and push to remote.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community