重写主分支机构
说我有这个犯罪历史:
A - B - C (master)
\
D - E - F (Feature)
我想修改pross b 。所以,我确实:
- git Checkout Master
- git rebase -i< hash的 a >
重新启动完成后,我看到使用GIT日志的更改。 但是,当我切换到功能分支时,提交 b 仍然与重新构想之前一样。 换句话说,当我在主人分支中时,提交历史如下:
A - B' - C (master)
当我切换到功能分支时,提交历史记录如下:
A - B - C (master)
\
D - E - F (Feature)
我知道重写提交历史并不明智,但在我的情况下我必须这样做。
我该如何修改旧的提交并在每个分支上反映这些更改? 我做错了吗?
新的提交历史将被迫将其推入Github,我不想把事情弄乱。
任何帮助将不胜感激。
Say I have this commit history:
A - B - C (master)
\
D - E - F (Feature)
I'd like to amend commit B. So, I do:
- git checkout master
- git rebase -i <hash of A>
After the rebase is done, I see the change using git log.
However when I switch to the Feature branch, commit B is still as it was before the rebase.
In other words, when I'm in master branch, the commit history looks like this:
A - B' - C (master)
When I switch to Feature branch, the commit history looks like this:
A - B - C (master)
\
D - E - F (Feature)
I understand that rewriting the commit history is not wise, but I have to do this in my case.
How can I amend an old commit and have those changes be reflected on every branch?
Am I doing this the wrong way?
The new commit history will be force pushed into Github and I don't want to mess things up.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重新构想后,您实际
现在已经完成了要完成操作,您必须重新安排
功能
on(最近重写)master
After your rebase, what you actually have is
So now to complete the operation you'd have to rebase
Feature
on (the recently rewritten)master
您需要手动重新重新置于每个分支机构。没有办法更改一个分支的内容,并将这些更改反映在其他分支上,这与GIT的工作方式相反。
You need to manually rebase every branch. There is no way of changing the contents of one branch and have those changes be reflected on other branches, that is antithetical to how Git works.