I want to squash my 3 last commit together (from ax38aa to ax18aa).
i had
commit ax18aa
commit ax28aa
commit ax38aa
commit ax48aa
commit ax58aa
Code
git rebase -i ax48aa
but was surprised that when i did git log i have only
commit ax48aa
commit ax58aa
and didn't ask mi the new message for the commit. How can i do? please? who can help please Thank youu,
It looks like you squash
ed all of the commits during your interactive rebase, leaving you in a state of rebasing
. This means that you are currently doing the rebase, but have not finished it and can only see the oldest two commits ax48aa
and ax58aa
. The easiest way to get out of this situation is to:
git rebase --abort
This will discard any changes you might have done and will put you in the state before the rebase. If by any chance you still do not see all of your 5 commits, then look into the reflog
with git reflog
, find the first commit and do git reset --hard ax18aa
.
Now do a new rebase again, but this time, pick
the oldest/top most commit of your interactive rebase.
git rebase -i HEAD~3
# or
git rebase -i ax48aa
and then do the following:
pick ax38aa commit message 3
squash ax28aa commit message 2
squash ax18aa commit message 1
This will do what you wanted.
Also keep in mind that after your rebase, you will have a new commit and you will need to force push to your remote repo in order for your changes to be uploaded!