简体   繁体   中英

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.

When I pulled the code, it showed this message Merge made by the 'recursive' strategy.

Then I pushed it to my forked copy on 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

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.

I have 2 questions

  1. What is the issue? What I did wrong and should avoid later on.
  2. How to fix it.

Rebase usually skips all the merge commits, which is usually what you want since rebase puts all your commits into a single line.

If you want it to try to keep the merges, and the structure, experiment with git rebase -p or git rebase -r .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM