Reputation: 4200
I have the following situation:
The question is, how can I merge these 2 last commits?
I used git rebase -i HEAD~1
, but I can't see the merge commit. Which is the alternative? I do this for making history clear.
Upvotes: 1
Views: 44
Reputation: 30317
If what you would like to do is take back the merge and apply X before the merge of Y:
git checkout X~2 # go to revision before merge
git cherry-pick X # apply the revision at the tip of X
git merge Y -m "Merging Y"
# if you like the results
git branch -f X
git checkout X
PS Attending @0andriy's worries, it's good to notice that this rewrites history. If you have already pushed what you have on X to a repo where other people might have already started playing with it, it's considered rude to rewrite history. If, on the other hand, it's something that you haven't pushed anywhere, then feel free to rewrite history.
Upvotes: 1