To merge branches in Git you can use git merge command.
Let’s see how you can do that:
Switch to the Branch You Want to Merge Into (typically main or master):
git checkout main
Run the Merge Command:
git merge <name-of-branch>
Replace <name-of-branch> with the name of the branch you want to merge.
If there will be any error, git will pause the merge and let you resolve them manually. After resolving, add the changes:
git add <file-name>
Complete the Merge: Once conflicts are resolved (if any), complete the merge with:
git commit
Example
To merge a branch called feature-branch into main:
git checkout main
git merge feature-branch