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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我在上面的编辑中提到的,事实证明我已经合并到 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.