Git Command: Pull latest code changes to sub branch

Pull the latest code merged code from the main, master branch to the sub-branch in git. Get the latest code from develop branch to sub-branch. Get the latest merged and updated code to our personal branch Github.

To get the latest changes to your from the main or master branch follow the steps.

  • Switch to your branch by Checkout to your branch

Example:

git checkout smartcoder/validation

using the above command I am checking out to my branch called: smartcoder/validation

After checking out to our branch we can pull the latest code from the main/master/develop branch using the below code:

git pull origin main

This will update my branch smartcoder/validation with the latest code that is available in the main branch. In my case all the reviewed codes from other branches are merged to the main branch. So the latest working code is in main branch so I pulling from the main to my branch.

About the Author: smartcoder

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *