user
How to create a new branch in Git ?
alphonsio

To create a new branch in Git, you can use the git branch command followed by the name of the new branch. Here's how you can do it:

git branch <branch_name>

For example, if you want to create a new branch named feature-123, you would use the following command:

git branch feature-123

After running this command, the new branch will be created, but you will still be on your current branch. To switch to the newly created branch, you can use the git checkout command:

git checkout feature-123

Alternatively, you can create and switch to the new branch in a single command by using the -b option with git checkout:

git checkout -b feature-123`

This command creates a new branch named feature-123 and switches to it immediately.

In recent versions of Git, you can also use the git switch command to create and switch to a new branch in one step:

git switch -c feature-123

This command creates a new branch named feature-123 and switches to it.

After creating the new branch, you can start making changes to your code, committing them to the branch as needed.