Forrest logo
back to the git tool

git-branch:tldr:0f237

git-branch: Create new branch based on the current commit.
$ git branch ${branch_name}
try on your machine

The command "git branch ${branch_name}" is used to create a new branch in Git with the specified branch name.

Here are the components of the command:

  • "git branch": This is the base command in Git used to manage branches.
  • "${branch_name}": This is a placeholder that represents the name you want to give to the new branch. It should be replaced with the actual name you desire for the branch.

When you run the command, Git will create a new branch using the specified name. This branch will initially be a copy of the branch you are currently on, also known as the "current branch" or "head branch". Any changes made in this new branch will be separate from the original branch until you merge them later.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool