![Forrest logo](/images/logo.png)
git-switch:tldr:cbd26
git-switch: Create a new branch and switch to it.
$ git switch --create ${branch_name}
try on your machine
The command git switch --create is used to create a new branch and switch to it at the same time. The branch_name is the name you want to give to the new branch.
Here is a breakdown of the command:
-
git switch: This is the command to switch branches in Git.
-
--create: This flag is used to create a new branch.
-
${branch_name}: This is a placeholder for the actual name you want to give to the new branch. You need to replace ${branch_name} with the desired name, without the curly braces.
When you execute this command, it will create a new branch with the specified name (branch_name) and switch to it. This means that any changes you make afterwards will be done on this newly created branch, keeping your main branch or any other branch unchanged.
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.