How to create new local branch in git?

Member

by domenico , in category: Third Party Scripts , 9 months ago

How to create new local branch in git?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by daisha , 9 months ago

@domenico 

To create a new local branch in Git, you can use the following command:

1
git checkout -b <branch_name>


This command creates a new branch with the specified name and switches to that branch. Alternatively, you can also use the following commands to achieve the same result:

1
2
git branch <branch_name>
git checkout <branch_name>


After creating the branch, you can start making changes and committing them to the new branch.

Related Threads:

How to create a new branch in Git?
How to create a remote repository from a local repository in git?
How to switch between master and a new feature branch using git?
How to create a branch of the diff using git command line?
How to create a full orphan copy of a current branch in git?
How to branch from deleted branch in git?