Clone repo then create new branch
Here are the steps to clone a repository and create a new branch:
Step 1: Clone the repository
Open a terminal or command prompt and navigate to the directory where you want to clone the repository. Then, use the following command to clone the repository:
git clone <repository_url>
Replace <repository_url>
with the URL of the repository you want to clone. For example:
git clone https://github.com/user/repository.git
This will create a local copy of the repository in a new directory with the same name as the repository.
Step 2: Create a new branch
Once you have cloned the repository, navigate to the local repository directory:
cd repository_name
Then, use the following command to create a new branch:
git branch <branch_name>
Replace <branch_name>
with the name you want to give to your new branch. For example:
git branch feature/new-login-system
This will create a new branch with the name feature/new-login-system
.
Step 3: Switch to the new branch
To switch to the new branch, use the following command:
git checkout <branch_name>
Replace <branch_name>
with the name of the branch you just created. For example:
git checkout feature/new-login-system
This will switch your local repository to the new branch.
That's it! You have now cloned a repository and created a new branch. You can start making changes to the code on this new branch.