将提交从一个分支移动到另一个分支
我已经在我的 git 存储库的 master 分支上提交了一系列更改,并将其推送到上游(尽管我是唯一一个在这些更改中工作的人。)我想要做的是取消最后几次提交,滚动将 master 恢复到拉取提交之前,将提交重新应用到开发分支,然后合并回 master。
这是我的存储库现在的样子:
a [master] [remotes/origin/master]
|
b
|
c
|
d (merge branch 'develop')
|\
| \
| e [develop] [remotes/origin/develop]
| |
q f
| |
r g
这就是我希望它的样子:
Z [master] [remotes/origin/master]
|\
| \
| A
| |
| B
| |
d C
|\ |
| \|
| e [develop] [remotes/origin/develop]
| |
q f
| |
r g
我可以得到一些帮助吗?我认为这是一项 rebase 工作,但我不太确定如何实现它。
I've committed a bunch of changes onto the master branch of my git repository, and pushed it upstream (although I'm the only one working out of these.) What I want to do is to pull these last few commits off, roll back master to before the pulled-off commits, re-apply the commits onto the develop branch, and then merge back onto master.
Here's what my repository looks like now:
a [master] [remotes/origin/master]
|
b
|
c
|
d (merge branch 'develop')
|\
| \
| e [develop] [remotes/origin/develop]
| |
q f
| |
r g
And here's what I want it to look like:
Z [master] [remotes/origin/master]
|\
| \
| A
| |
| B
| |
d C
|\ |
| \|
| e [develop] [remotes/origin/develop]
| |
q f
| |
r g
Can I get some help on this? I'm thinking this is a job for rebase, but I'm not quite sure how to make it happen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这里:
您可能想要选择一个比 foo 更具描述性的分支名称,因为它将记录在 Z 的合并提交消息中。
Here you are:
You might want to pick a more descriptive branch name than foo, since it'll be recorded in the merge commit message for Z.