发布于 2024-12-20 22:53:26 字数 8 浏览 0 评论 0原文

continue

I had a local branch which was branched off master quite some time ago, on which there were several commits. I wanted to get this local branch up to date with master so I did

git co my_branch
git rebase master

expecting this to replay the commits in my_branch on top of master. However, it seems to have instead merged the commits in my_branch into master and then brought my_branch forward to the same place as master, i.e. I've gone from this:

A -- B -- C -- D master, origin/master
      \
       E -- F my_branch

to this:

A -- B -- E -- F -- C -- D master, origin/master, my_branch

when I was expecting this:

A -- B -- C -- D master
                \
                 E' -- F' my_branch

My question is not so much why it did this, but whether I can put things back to where they were originally, since presumably the inserted commits will be problematic when interacting with the remote repository (to which subsequent commits have been pushed).

Edit

It turns out that I had already merged in the branch. So, the rebase had nothing to do and just left the my_branch pointer in same place as master.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云仙小弟 2024-12-27 22:53:26

正如我在上面的编辑中提到的,事实证明我已经合并到 my_branch 中。因此,分支提交已经是 master 的一部分,并且在将 my_branch 指针移动到 master 中的最后一次提交后,rebase 没有任何作用。

As mentioned in my edit above, it turns out I had already merged in my_branch. So, the branch commits were already part of master, and the rebase had nothing to do after moving the my_branch pointer to the last commit in master.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文