Create a new branch in github
Here are the steps to create a new branch in GitHub:
Using the GitHub Web Interface:
- Log in to your GitHub account and navigate to your repository.
- Click on the "Code" button on the top left corner of the repository page.
- Click on the "New branch" button.
- Enter a name for your new branch in the "Branch name" field. You can also choose a base branch from the dropdown menu.
- Click on the "Create branch" button.
Using the Command Line:
- Open your terminal and navigate to your local repository directory.
- Use the following command to create a new branch:
git branch <branch-name>
- Replace
<branch-name>
with the name you want to give your new branch. - To switch to the new branch, use the following command:
git checkout <branch-name>
- To push the new branch to your remote repository, use the following command:
git push origin <branch-name>
Example:
Let's say you want to create a new branch called "feature/new-login-system". Here are the steps:
Using the GitHub Web Interface:
- Log in to your GitHub account and navigate to your repository.
- Click on the "Code" button on the top left corner of the repository page.
- Click on the "New branch" button.
- Enter "feature/new-login-system" in the "Branch name" field.
- Click on the "Create branch" button.
Using the Command Line:
- Open your terminal and navigate to your local repository directory.
- Run the command:
git branch feature/new-login-system
- Run the command:
git checkout feature/new-login-system
- Run the command:
git push origin feature/new-login-system
That's it! Your new branch should now be created and available in your repository.