目前我的分支看起來像這樣:
Branch A
/
main-Branch B
\
Branch C
但我想看起來像這樣:
Branch A
/
main-Branch B
\
Branch C
如何移動分支 C,使其從主分支(遠程)分支?
uj5u.com熱心網友回復:
您可以使用git rebase --onto然后強制將分支推送到您的遙控器。請注意,用力推動會造成很大的傷害,所以要知道你在做什么。
請參閱本節git help rebase:
Another example of --onto option is to rebase part of a branch. If we
have the following situation:
H---I---J topicB
/
E---F---G topicA
/
A---B---C---D master
then the command
git rebase --onto master topicA topicB
would result in:
H'--I'--J' topicB
/
| E---F---G topicA
|/
A---B---C---D master
This is useful when topicB does not depend on topicA.
在您的情況下,如果您在 branchC 上:
$ git rebase --onto main branchB
uj5u.com熱心網友回復:
這是git-rebase檔案中發現的經典 rebase 問題。
您需要指定您只想將提交從 branchB 到 branchC 重新系結到 main 上。
git rebase --onto main branchB branchC
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/315581.html
