[英]Git merge master branch into some other branch
我的master-app位於一個master分支。
我正在使用主應用程序頂部的webshop模塊擴展該應用程序。
當我對主應用程序進行更改時,我希望它們也出現在webshop-app中嗎?
當我現在進行git checkout網上商店時,我對主服務器所做的更改丟失了,我必須將它們復制到網上商店中。
我現在應該做什么:
git checkout master
git add .
git commit -m "changes made to master application"
git push origin master
git checkout webshop
// copy and paste my changes here
git add .
git commit -m "Changes also made here"
git push origin webshop
我嘗試了這個:
git push origin master webshop
但這只是在我在atm的分支中推動提交
這應該可以解決問題:
git checkout webshop
git merge master
您可以(應該)一次僅提交一個git分支。
想要對多個分支提交更改,這對我說,您要么誤解了GIT的預期工作流,要么試圖將其轉變為非其設計的用例。
您只需要/想要一次將更改提交到一個分支。 然后,如果/當您希望這些更改出現在另一個分支中時,將其合並。
$ git checkout webshop
... make changes as needed, test, etc
$ git add .
$ git commit -m "some changes are made"
$ git push origin webshop
... then, when your'e ready to merge into your main branch (as said by @vasekhlav)
$ git checkout master
$ git merge origin/webshop
... all changes made in webshop will now be in master, providing there were no conflicts that need to be resolved.
之后,您再次結帳網上商店,然后繼續進行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.