[英]Git rebase not showing merge commit
I pulled code from upstream and merged it with my code.我从上游提取代码并将其与我的代码合并。
In upstream currently, there are only my previous commits, and PR merge commits.目前在上游,只有我以前的提交和 PR 合并提交。
When I pulled the code, it showed this message Merge made by the 'recursive' strategy.
当我拉出代码时,它显示了这条消息
Merge made by the 'recursive' strategy.
Then I pushed it to my forked copy on github.然后我将它推送到 github 上的分叉副本。
This created a new commit with the following message:这创建了一个带有以下消息的新提交:
Merge branch 'master' of https://github.com/Girl-Code-It/Girl-Code-It… …
I wanted to squash my previous commit.我想压缩我之前的提交。
Now when I do git log
现在当我做
git log
The latest commit is Merged message one最新的提交是合并的消息一
But when I type git rebase -i HEAD~2
, then it shows me the 2nd last commit and 3rd last, in other words acts like Merge commit never happened.但是当我输入
git rebase -i HEAD~2
时,它会向我显示第二次最后一次提交和第三次最后一次提交,换句话说,就像合并提交从未发生过。
I have 2 questions我有 2 个问题
Rebase usually skips all the merge commits, which is usually what you want since rebase puts all your commits into a single line. Rebase 通常会跳过所有合并提交,这通常是您想要的,因为 rebase 会将所有提交放在一行中。
If you want it to try to keep the merges, and the structure, experiment with git rebase -p
or git rebase -r
.如果您希望它尝试保留合并和结构,请尝试使用
git rebase -p
或git rebase -r
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.