In today's article I will show you how you can create a branch of a GitHub repository using visual studio 2022. For creating a branch first, we need to signup for GitHub account. After signup we need to
create a public or private repository in GitHub account. After successful creation of repository let's check where we can get the Branch detail in the repository. Please check the below image this shows how your repository will look like.

Here in above image, you can see the two items first one is main, and the second one is branch. Now let's click on Branch and what item are there.
In Branch section we are having only main. No other thing. So, it shows the main is also a branch which is nothing but the master branch of the repository.
After successfully creating the repository, we will checkout or clone the repository code from GitHub from visual studio 2022. After successful checkout we need to close the visual studio and open the project solution again. As you open the visual studio you need to look the bottom right corner of visual studio, it will look as shown below.
Now to create a new branch first we need take the latest of code in your local. Now the question is coming why we are taking latest of main branch, because if there is a large team your multiple people is working on same repository you may miss some piece of code which other have worked. so, take the latest click on "
Git Changes" tab.
After selecting the "Git Change" tab you need to look on the top right corner of the tab.
In above image please check the three highlighted arrow. In this first one reparent the "
Fetch", second one represents the "
Pull" and third one represents the "
Push". So, the Get the latest code in local first you need click on "
Fetch". This will show how many changes are remaining or the outstanding. In above you can see there is only 1 outstanding is there means there is only one difference between local code and the repository code.
Now click on second option which is "Pull". You will get a window as shown below.
This window will disappear automatically one's processing is completed. After this click on "Push" to sync the changes.
After completion of process the outstanding will become zero, means our local code is same we are having in Git repository. Now let's come back to creating the branch. To create a branch, we need to click on bottom right corner where we are seeing the option for main branch.
Here in this window add the new branch name in "Filter branches" textbox and click on "New Brach" button. As you click on the button a new window will open as shown below.
In above image we are having "Branch Name" and "Based on". Here "Based on" is the branch name which code you want to check out. In our case it is main.
Now we have done by creating the branch. But it will still not reflect in you account. To reflect the branch in your repository you need to perform m the "Fetch" and "Push".
This is nothing but we are publishing you newly created branch. Now let's check the Git account for the created new Branch.
Here we can see now we are having two branches. Now let's click on "Branches" and check how it looks like.