Ans- To create a new branch called `feature` using Git, follow these steps:
1. Open your terminal or command prompt and navigate to the root directory of your Git repository.
2. Check the current branch by running the command `git branch`. This will show you the list of existing branches and highlight the currently checked out branch (typically `master` or `main`).
3. Create a new branch called `feature` using the command `git branch feature`. This will create a new branch but will not switch to it yet.
4. Switch to the newly created `feature` branch using the command `git checkout feature`. This command checks out the `feature` branch and makes it the current working branch.
Alternatively, you can combine steps 3 and 4 by using the `-b` option with the `checkout` command, like this: `git checkout -b feature`.
5. After running the `git checkout` command, you will be switched to the `feature` branch. You can now start working on this branch, committing changes, and making modifications specific to this feature.
Here's an example of the commands:
$ git branch
* main
$ git branch feature
$ git checkout feature
Switched to branch 'feature'
Now you have successfully created a new branch called `feature` and switched to it. You can continue working on this branch independently of the `main` or any other existing branches in your Git repository.
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc