[英]Git rebase and git merge
我知道,如果我准備好與遠程主服務器合並的分支,則需要執行以下操作:
git checkout'我的分支'
git rebase master(因為我想要簡單的歷史記錄+我的更改很小,所以可以重新設置)。 但這將與我的本地主服務器而不是原始主機重新建立基礎,對嗎?
git checkout主
git merge'my branch'-這將進行快速合並並完成該過程。
但是如何與遠程主服務器合並呢? 我在互聯網上看不到任何明確的解釋。 我不能僅在3d步驟中簽出Origin Master。 我想念什么?
您可以像這樣簡單地基於原始主機
git rebase origin/master
您也可以跳過3.和4.簡單地將您的基礎分支推送到原點/主節點
git push origin my_branch:master
遠程主服務器就是遠程回購所標識的master
。 每當您從origin
遠程獲取時,該遠程master
git標記就會作為您的origin/master
提交(在您的remotes
引用中)。
更新遠程倉庫的引用的方法是推送到它(它還會發送任何提交或任何其他需要的東西)。 所以:
git checkout master # or however you want to get `master` current with origin
git pull # ...
git checkout mybranch
git rebase master
git checkout -B master # you know it's going to --ff, so just move the ref
# or, you could `git checkout master; git merge mybranch`
git push origin master # push the new commits to the remote's `master`
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.