简体   繁体   English

如何在 Git 中合并工作分支和主分支?

[英]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.我一直在做一个项目,我正在使用 Git 和 Github 进行版本控制。

I have a main branch and a product-page branch.我有一个main分支和一个product-page分支。 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.当我在product-page上工作时,我不得不在主分支中更改一些东西,所以我从main分支(而不是product-page )做了另一个分支nav-change并做了一些更改并将其推送到 Github 和甚至将它合并到那里,现在更改是我的主分支的一部分,但现在我希望这些更改也包含在product-page分支中。

What should I do?我应该怎么办?

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.只需在分支product-page执行git merge main分支(以及来自nav-change的额外更改),您需要在其中进行此额外更改。

But be careful, merge conflicts can arise!但要小心,可能会出现合并冲突

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM