DEV Community

smrpdl1991
smrpdl1991

Posted on

Merging the Main branch into your local branch

Image description

To merge your local branch to the main branch , you need to follow these steps :

  1. First, you need to ensure, you are on your local branch.
    git checkout <your-branch>

  2. Second, you need to fetch the latest changes from the remote.
    git fetch origin

  3. Now, let's merge Main branch into your local branch.
    git merge origin/main

  4. If there are any conflicts, then you need to manually edit the
    conflicted file and resolve the conflict and then
    git add <conflicted-file>
    git commit -m "Merged main branch into <your-branch>"

Following these steps, you will be able to merge remote branch to your local branch.

Top comments (0)