{"thread":{"id":"26020","subject":"Oops, I screwed it up","startedAt":"2010-12-10T18:31:23Z","lastAt":"2010-12-10T23:01:05Z","messageCount":2,"participants":["Péter András Felvégi","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"157831","messageId":"AANLkTi=eFmCjdBYHx9Jy=Q7993GghuV1dp12E4Aj7pkZ@mail.gmail.com","threadId":"26020","inReplyTo":"AANLkTinyZ-dqV5=yaucLZTj14hdxS61v=VT-j82SqN7r@mail.gmail.com","subject":"Oops, I screwed it up","fromName":"Péter András Felvégi","fromEmail":"petschy@gmail.com","sentAt":"2010-12-10T18:31:23Z","receivedAt":"2010-12-10T18:31:23Z","isPatch":false,"sender":{"key":"petschy@gmail.com","avatar":null},"body":"Dear All,\n\nI did some rebasing which ended in an unexpected result.\n\nThis is what I did precisely:\n- added 3 files to the index, then committed (#1)\n- realized that a file was left out (not yet tracked), so added + committed it\n- stashed the local changes\n- used rebase -i to meld the last commit into the previous one (fixup)\n- stash pop\n- added more files to the index, committed (#2)\n- made some minor changes to a file committed in #1, added, committed\n- decided to meld into #1\n- there were 3 more locally changed files\n- stashed them\n- rebase -i, moved the last item one line up, set to fixup, so that it\nmelds into #1\n- stash pop: surprise! the stash was empty\n\ngit log --stat showed that the 3 stashed files got melded into commit #1, too.\n\nI didn't expect this. Is this the normal operation?\n\nI was able to undo the effects by rebase -i, edit (as in the git\nrebase manpage under SPLITTING COMMITS), committing again w/o the 3\nfiles I didn't need, saving them to a temp dir, revert them via\ncheckout, rebase --continue, then move the files from temp to have\nthem locally changed again. This is where I would have been if stash\npop succeeded.\n\nThe files in commit #1, #2, and the last 3 locally changed ones where disjunct.\n\nI don't know how those 3 locally changed, stashed files ended up in\nthe commit. I checked my command line history, I wasn't adding them.\n\nUnfortunately, I wasn't able to reproduce the phenomenon on a test\nrepo, by 3 files:\n- commit a, b, c\n- change a, commit\n- change b, commit\n- change a, commit\n- change c\n- stash c\n- rebase -i to meld the two a's, making b the last commit\n- stash pop : it worked\n\nAny ideas?\n\nI'm using git version 1.7.2.3 under Debian Squeeze AMD64.\n\nPlease CC me, I'm not on the list. Thanks.\n\nRegards, Peter\n"},{"id":"157852","messageId":"m239q58c7i.fsf@igel.home","threadId":"26020","inReplyTo":"AANLkTi=eFmCjdBYHx9Jy=Q7993GghuV1dp12E4Aj7pkZ@mail.gmail.com","subject":"Re: Oops, I screwed it up","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-12-10T23:01:05Z","receivedAt":"2010-12-10T23:01:05Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Péter András Felvégi <petschy@gmail.com> writes:\n\n> This is what I did precisely:\n> - added 3 files to the index, then committed (#1)\n> - realized that a file was left out (not yet tracked), so added + committed it\n\nFWIW, at this point doing \"git commit --amend\" would have been easier\nand avoided the need to stash.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}