68 views

Switch to another branch in local Repository

In order to understand this concept, I have created another branch in the git repository by the name of “sub-branch”. See the below image for the same.


Now, rest of the activity is explained through series of steps.

STEP 1 : Open Git GUI. Go to Remote->Fetch From->origin. See the below SS for the same.



As you can see, new branch is fetched to our local.

STEP 2 : Now, we have to create a name for this branch in my local Repository. Go to Branch->Create

As you can see, I have a given name to local branch same as git name which is sub-branch.Click on Create Now.

STEP 3 : Now, Go to Branch->Checkout . Choose the sub-branch Local branch.

Click on Checkout. Now, you are pointed to sub-branch locally which has same data as of master branch. This is how , you can switch to another branch.

The logic is very simple. If you perform any change in any of the branch in git repository, you can get those changes into your local using
“Remote->Fetch From ->origin”.

Related posts