In the previous video, you learned how to work with branches, but we didn't merge the
changes yet. So how do you do that? Well, after making changes to a branch, the changes
can be merged in the main branch. That is what you normally do when everybody is all
right with your change. First, it's a good idea to have a look at the differences. So
you can use git diff main new files to check the differences between the main branch and
the new files branch. After using git checkout main, you're back in the main branch, and
you can use git merge new files to apply changes from the branch to the main branch. If files
have been modified to multiple branches, it's more complex because automatic merges are
not possible when merge conflicts exist. And in such a case, the conflicts must be resolved
manually by editing the affected files. And that's not easy. Now, continuing on the preceding
demo, you can use git merge new files to merge changes from new files in the main branch.
Let me show you. So to start it, I'm using git status, which is showing that we are in
main, and I'm going to use git diff main new files. And there we can see that in diff,
there is this 3.txt, and that does not exist. So I'm going to use git merge new files. And
then when I use ls, there you can see 3.txt does exist. And that is how you merge these
branches. And from here on, it's business as usual.