Re: Lost commit during rebase!
- From
- Robert Dailey <rcdailey.lists@gmail.com>
- Date
- Mar 20, 2014, 19:41 UTC
- Message-ID
- <CAHd499AM5niunTURoop+JspxMgBwhWY8upRpo5RU-gux7+BZ8A@mail.gmail.com>
- In-Reply-To
- <CAHd499CBkuCJvZ+U3GEcnw0UFot5JooZVdj2sHT_3p0s6ScwcQ@mail.gmail.com>
Sorry it looks like I missed some basic documentation: http://git-scm.com/docs/git-rebase
This issue (combining preserve merges with interactive option) is described in the BUGS section.
Is there a way I can go about this without losing my merge commits?
On Thu, Mar 20, 2014 at 2:37 PM, Robert Dailey <rcdailey.lists@gmail.com> wrote:
Show 71 quoted lines
> I have a local-only branch with just under 70 commits. I also have
> merge commits on this branch.
>
> The log of the top few commits on my branch looks like so:
>
> * de651ff (20 minutes ago) (HEAD, survey) Robert Dailey - WIP:
> GOTO implementation
> * 2a68a23 (21 minutes ago) Robert Dailey - Move boost::phoenix
> include & namespace changes to own header file
> * e1cd568 (19 hours ago) Robert Dailey - WIP: GOTO flow changes
> * b039bb5 (19 hours ago) Robert Dailey - Remove superfluous
> include of own header
> * 4bdeb27 (20 hours ago) Robert Dailey - Rename NavigateBackwards()
>
> I had two commits that I wanted to squash and also reorder another
> one. The command I ran is:
>
> git rebase -pi `git merge-base origin/master survey`
>
> I ran this command with 'survey' branch checked out. Once my editor
> appears, the last few commits in the file look like so:
>
> pick 4bdeb27 Rename NavigateBackwards()
> pick b039bb5 Remove superfluous include of own header
> pick e1cd568 WIP: GOTO flow changes
> pick 2a68a23 Move boost::phoenix include & namespace changes to own header file
> pick de651ff WIP: GOTO implementation
>
> I modify the last 3 commits in the file so now it looks like this:
>
> pick 4bdeb27 Rename NavigateBackwards()
> pick b039bb5 Remove superfluous include of own header
> pick 2a68a23 Move boost::phoenix include & namespace changes to own header file
> pick e1cd568 WIP: GOTO flow changes
> squash de651ff WIP: GOTO implementation
>
> What I did was:
>
> 1. Move 2a68a23 back one commit
> 2. Mark de651ff for squash
>
> After this, I save the file, close, and rebase operations begin. After
> the rebase is done, my log looks like this:
>
> * 94d06df (19 hours ago) (HEAD, survey) Robert Dailey - WIP:
> GOTO flow changes
> * b039bb5 (19 hours ago) Robert Dailey - Remove superfluous
> include of own header
> * 4bdeb27 (20 hours ago) Robert Dailey - Rename NavigateBackwards()
>
> Notice that the commit with description "Move boost::phoenix include &
> namespace changes to own header file" is missing! I looked at reflog:
>
> $ git reflog
> 94d06df HEAD@{0}: rebase -i (finish): returning to refs/heads/survey
> 94d06df HEAD@{1}: rebase -i (squash): WIP: GOTO flow changes
> e1cd568 HEAD@{2}: rebase -i (pick): updating HEAD
> 2a7b27a HEAD@{3}: rebase -i (pick): Move boost::phoenix include &
> namespace changes to own header file
> b039bb5 HEAD@{4}: rebase -i (pick): updating HEAD
> 4bdeb27 HEAD@{5}: rebase -i (pick): updating HEAD
> 2e40bcd HEAD@{6}: rebase -i (pick): updating HEAD
> 3ca6bb3 HEAD@{7}: rebase -i (pick): updating HEAD
> e63b1e5 HEAD@{8}: rebase -i (pick): updating HEAD
> 4d40c00 HEAD@{9}: rebase -i (pick): updating HEAD
> ec078c1 HEAD@{10}: rebase -i (pick): updating HEAD
> de48c5d HEAD@{11}: rebase -i (pick): updating HEAD
>
> It shows that it "picked" the commit that's missing now. Is this a bug
> or am I not doing something right? I'm using Git for Windows version
> 1.9.0