give command to create branch on git
- User
give command to create branch on git
- Assistant
To create a new branch in Git, you can use the
git branchcommand followed by the name of the branch you want to create. Here's the command format:git branch <branch-name>Replace
<branch-name>with the desired name for your new branch. For example, to create a branch named "feature-x", you would run the following command:git branch feature-xThis command will create the branch, but it will not switch your working directory to the new branch. To switch to the new branch, use the
git checkoutcommand like this:git checkout feature-xAlternatively, you can both create and switch to the new branch in a single command using
git checkout -b. Here's how: