Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Rebase seems to have worked but all commits are still showing in the log... what state am I in?

Tags:

git

rebase

I think I squashed the last 40 commits using rebase. I was following this guide to make sure I didn't do anything stupid - http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

The problem is, I think I did something stupid.

The (interactive) text file couldn't be saved, so it seems that the rebase failed but the message it gave and some other things below suggest it might have worked.

Not sure where I am or what to do (or even what my name is). Here's what I did:

  • I typed git rebase -i HEAD~40
  • A text file came up, which I edited, by changing all lines to start with 'squash' except the top one
  • I'm on windows, using EditPad... the file can't be saved! Oh noes... (read-only/permissions?).
  • I save it to a random directory.
  • The command line shows some sort of success (unfortunately I've lost the message). I don't know how it could succeed or know where the file I saved is...

  • git rebase --continue says "No rebase in progress?

  • git reflog suggests it worked (from what I know at least, the word 'rebase' is showing on the last 40 odd commits) eg:

    9992445 HEAD@{8}: rebase: reports working

  • but running git log shows all 40 commits I just 'rebased'

This isn't looking good. Does anyone know what state I'm in? Am I in limbo, was this a zombie rebase?

like image 606
PandaWood Avatar asked Jul 29 '11 07:07

PandaWood


1 Answers

If the rebase "todo list" couldn't be saved, your rebase didn't work.

The easiest way to squash that many commits would be to do git reset --soft HEAD~40 and then git commit with your new message - assuming you want to squash all of them.

like image 145
dahlbyk Avatar answered Oct 01 '22 15:10

dahlbyk