Search code examples
gitgithubgit-mergegit-branch

How to merge a working branch and main branch in Git?


I have been working on a project and I'm using Git and Github for my version control.

I have a main branch and a product-page branch. While I was working on product-page, I had to change something in main branch, so I made another branch nav-change from the main branch (and not the product-page) and I made a few changes and pushed it to Github and even merged it there and now the changes are part of my main branch, but now I want those changes to also be in product-page branch.

What should I do?


Solution

  • Just do git merge the main branch (with the additional changes from nav-change) in the branch product-page, where you need this additional changes.

    But be careful, merge conflicts can arise!