Reputation: 3158
I have a git branch axel
that I want to rebase on master
using git rebase master
.
But when I'm doing that, the result is like I had typed git reset master --hard
.
What is happening here? How can I rebase my branch upon master
?
Here's a visual representation depicting my git log:
(followup)
PS D:\Documents\…> git cat-file 48d0 -p
tree 2c70dc8ec913213a8b371e72ec7d0260f32fe60b
parent 0069be8975d4dd3c01afb6356eaf5c05019e2db0
parent 01724c632d34037ffcdc873e60f8224b80e281f1
author Axel … 1665479799 +0200
committer Axel … 1665479799 +0200
...
Upvotes: 0
Views: 243
Reputation: 13377
As you can see, commit 48d0
is the only commit on branch axel
that is not also in branch master
. This commit is a merge commit.
When you run
git rebase master
,
merge commits are omitted, therefore, no commits to be rebased remain, and the net result is the same as a git reset --hard master
.
EDIT: It looks like there are additional edits in the merge commit (it's an "evil merge"). I would do this to make a new commit on top of master
:
git checkout master
git merge --no-commit axel
# resolve conflicts if necessary
git reset # forgets that there was a merge being made; keeps contents
git commit -a
This transfers the additional edits that the merge commit contains and puts them as new commit on the destination branch. But it does not keep the author and author date. If that is also important, use this and edit the commit message if necessary:
git commit -a -c axel
Upvotes: 1