{"thread":{"id":"18254","subject":"Confusing `stash apply` behavior","startedAt":"2009-03-10T19:46:00Z","lastAt":"2009-03-11T12:45:34Z","messageCount":3,"participants":["Tim Visher","Nanako Shiraishi"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"107603","messageId":"c115fd3c0903101246n1eff50d4rc819e5fe7586a974@mail.gmail.com","threadId":"18254","inReplyTo":null,"subject":"Confusing `stash apply` behavior","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2009-03-10T19:46:00Z","receivedAt":"2009-03-10T19:46:00Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"Hello Everyone,\n\nI was just trying to do some experimentation with `stash` and I've run\ninto a problem.\n\nI was working on my `master` branch and decided that I wanted to\ncreate a `dev` branch.  I did `git stash` and then `git checkout -b\ndev`.  Then I did `git stash apply` and everything worked as expected.\n I continued working but then realized that I wanted a `refactoring`\nbranch.  In the process of continuing to work I had also cleared the\nstash stack with `git stash clear`, although this had no visible\neffect other than to remove any entries from `git stash list`.  As\nbefore, I did `git stash` and then `git checkout -b refactoring` and\nhere lies my problem.\n\nWhen I do `git stash apply`, it deletes the file I'm working with.\n\n    $ ls\n    featureList.txt*  keycontrol.mdb*\n\n    $ git show stash@{0}\n    commit b3c0f4b9b3c3ef7741a03fb27174f5838abc939d\n    Merge: 9fb9886 112bba9\n    Author: Tim Visher <timothy.visher@fms.treas.gov>\n    Date:   Tue Mar 10 15:25:04 2009 -0400\n\n    WIP on dev: 9fb9886 Added DB Lock file to .gitignore. EOM\n\n    diff --cc keycontrol.mdb\n    index 68a9bac,68a9bac..0000000\n    --- a/keycontrol.mdb\n    +++ b/keycontrol.mdb\n\n    $ git stash apply\n    Removing keycontrol.mdb\n    # On branch refactoring\n    # Changed but not updated:\n    #   (use \"git add/rm <file>...\" to update what will be committed)\n    #   (use \"git checkout -- <file>...\" to discard changes in working\ndirectory)\n    #\n    #       deleted:    keycontrol.mdb\n    #\n    no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nConsidering the output of `git show` I would expect that the contents\nof the stash are, well, what I expect them to be: a new version of\nkeycontrol.mdb.\n\nI'm sure I'm missing something completely juvenile but I could really\nuse some help because that stash represents about an hours worth of\nwork.  Not something to totally loose sleep over but something that\nwould be nicer to not have to do over.\n\nThanks in advance for your help!\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"},{"id":"107664","messageId":"20090311190217.6117@nanako3.lavabit.com","threadId":"18254","inReplyTo":"c115fd3c0903101246n1eff50d4rc819e5fe7586a974@mail.gmail.com","subject":"Re: Confusing `stash apply` behavior","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-03-11T10:02:17Z","receivedAt":"2009-03-11T10:02:17Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Tim Visher <tim.visher@gmail.com>:\n\n> When I do `git stash apply`, it deletes the file I'm working with.\n>\n>     $ ls\n>     featureList.txt*  keycontrol.mdb*\n>\n>     $ git show stash@{0}\n>     commit b3c0f4b9b3c3ef7741a03fb27174f5838abc939d\n>     Merge: 9fb9886 112bba9\n>     Author: Tim Visher <timothy.visher@fms.treas.gov>\n>     Date:   Tue Mar 10 15:25:04 2009 -0400\n>\n>     WIP on dev: 9fb9886 Added DB Lock file to .gitignore. EOM\n>\n>     diff --cc keycontrol.mdb\n>     index 68a9bac,68a9bac..0000000\n>     --- a/keycontrol.mdb\n>     +++ b/keycontrol.mdb\n>\n>     $ git stash apply\n>     Removing keycontrol.mdb\n>     # On branch refactoring\n>     # Changed but not updated:\n>     #   (use \"git add/rm <file>...\" to update what will be committed)\n>     #   (use \"git checkout -- <file>...\" to discard changes in working\n> directory)\n>     #\n>     #       deleted:    keycontrol.mdb\n>     #\n>     no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>\n> Considering the output of `git show` I would expect that the contents\n> of the stash are, well, what I expect them to be: a new version of\n> keycontrol.mdb.\n\nThe 'index' line in your 'diff --cc' output says that back when you created that stash, the HEAD and your index both held a blob object 68a9bac and your working tree didn't have that file, ie, removed. It is very natural that the file is removed when you apply that stash.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"107682","messageId":"c115fd3c0903110545o67b00fe2u3bb4924b5c84c0ce@mail.gmail.com","threadId":"18254","inReplyTo":"20090311190217.6117@nanako3.lavabit.com","subject":"Re: Confusing `stash apply` behavior","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2009-03-11T12:45:34Z","receivedAt":"2009-03-11T12:45:34Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"On Wed, Mar 11, 2009 at 6:02 AM, Nanako Shiraishi <nanako3@lavabit.com> wrote:\n> Quoting Tim Visher <tim.visher@gmail.com>:\n>\n>> When I do `git stash apply`, it deletes the file I'm working with.\n>>\n>>     $ ls\n>>     featureList.txt*  keycontrol.mdb*\n>>\n>>     $ git show stash@{0}\n>>     commit b3c0f4b9b3c3ef7741a03fb27174f5838abc939d\n>>     Merge: 9fb9886 112bba9\n>>     Author: Tim Visher <timothy.visher@fms.treas.gov>\n>>     Date:   Tue Mar 10 15:25:04 2009 -0400\n>>\n>>     WIP on dev: 9fb9886 Added DB Lock file to .gitignore. EOM\n>>\n>>     diff --cc keycontrol.mdb\n>>     index 68a9bac,68a9bac..0000000\n>>     --- a/keycontrol.mdb\n>>     +++ b/keycontrol.mdb\n>>\n>>     $ git stash apply\n>>     Removing keycontrol.mdb\n>>     # On branch refactoring\n>>     # Changed but not updated:\n>>     #   (use \"git add/rm <file>...\" to update what will be committed)\n>>     #   (use \"git checkout -- <file>...\" to discard changes in working\n>> directory)\n>>     #\n>>     #       deleted:    keycontrol.mdb\n>>     #\n>>     no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>>\n>> Considering the output of `git show` I would expect that the contents\n>> of the stash are, well, what I expect them to be: a new version of\n>> keycontrol.mdb.\n>\n> The 'index' line in your 'diff --cc' output says that back when you created that stash, the HEAD and your index both held a blob object 68a9bac and your working tree didn't have that file, ie, removed. It is very natural that the file is removed when you apply that stash.\n\nHuh.  I don't know how that would have happened, but I guess I should\nhave been more careful with the stash command.  Oh well.\n\nThanks for your help!\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"}]}