gpt4 book ai didi

git - 将远程分支 rebase 到 master 上,同时保持远程分支更新

转载 作者:太空狗 更新时间:2023-10-29 12:50:04 24 4
gpt4 key购买 nike

我正在尝试将我的远程分支 rebase 到 master,但我想让远程分支指向它的提交,只是基于 master 中的不同点。

这是我的结构:

A - B - C - D  (origin/master)
\
R - S - T (origin/develop)

我愿意:

A  - B - C - D (origin/master) - R - S - T (origin/develop)

如果不进行某种 merge ,这样的 rebase 是否可行?

最佳答案

要了解有关 rebase 的更多信息,您可以查看此 link或者在你的终端输入 git rebase --help

要解决您的问题,有一个简单的方法,请按照以下步骤操作:

git branch -D develop //this will remove your local develop repository
git fetch //update references
git checkout develop //change to develop branch, but because you deleted, this command will also download the origin/develop
git rebase -p origin/master

在这一步你可能会遇到一些冲突,所以解决它们并 git add FILES THAT HAD CONFLICTSgit rebase --continue

现在检查 rebase 后是否一切正常,如果是

git push -f origin develop

关于git - 将远程分支 rebase 到 master 上,同时保持远程分支更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39920992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com