{"thread":{"id":"27915","subject":"Surprise at git stash pop","startedAt":"2011-07-25T15:45:56Z","lastAt":"2011-07-26T09:26:06Z","messageCount":3,"participants":["Péter András Felvégi","Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171991","messageId":"CAG3eYYRdvi-JdPfZmH_1EhEpjdweZFc6NS54btEz0nWy=O3+vA@mail.gmail.com","threadId":"27915","inReplyTo":null,"subject":"Surprise at git stash pop","fromName":"Péter András Felvégi","fromEmail":"petschy@gmail.com","sentAt":"2011-07-25T15:45:56Z","receivedAt":"2011-07-25T15:45:56Z","isPatch":false,"sender":{"key":"petschy@gmail.com","avatar":null},"body":"Hello,\n\n'git stash pop' erased my local modifications, but not all of them.\nHere is the dump of my terminal window with comments:\n\n1) 1 item in the stash:\n\npetschy@stormbringer:~/...$ git stash list\nstash@{0}: WIP on 20110207-oracle: 089709b Merge branch\n'20110207-oracle' of ssh:.... into 20110207-oracle\n\n2) the status of the working tree\n\npetschy@stormbringer:~/...$ git status\n# On branch 20110207-oracle\n# Your branch is ahead of 'origin/20110207-oracle' by 2 commits.\n#\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#    modified:   SQLQueryCache.cpp\n#    modified:   SQLQueryCache.hpp\n#    modified:   ../../server/plugins-src/ads/AdsPlugin.cpp\n#    modified:   ../../server/plugins-src/ads/AdsPlugin.hpp\n\n3) querying the details of the stashed item\n\npetschy@stormbringer:~/...$ git stash show stash@{0}\n build-configs.def |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\n4) popping it, naively\n\npetschy@stormbringer:~/...$ git stash pop\nAuto-merging build-configs.def\nCONFLICT (content): Merge conflict in build-configs.def\n\n5) surprise, surprise!\n\npetschy@stormbringer:~/...$ git status\n# On branch 20110207-oracle\n# Your branch is ahead of 'origin/20110207-oracle' by 2 commits.\n#\n# Unmerged paths:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n#\n#    both modified:      ../../build-configs.def\n#\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#    modified:  SQLQueryCache.cpp\n\nALL of the local modifications to SQLQueryCache.hpp, AdsPlugin.cpp/hpp\nsimply disappeared! Is this the expected behaviour? I don't think so.\nSince the stash contained only one file, which had nothing to do with\nthe pending modifications, I thought it's safe to pop. And even if the\nlocal modifications and the stashed files overlap, I'd expect a\nwarning, at least. Half day's work gone. And if this is business as\nusual, why not all my local modifications were wiped?\n\nRegards, Peter\n"},{"id":"171998","messageId":"5fuhYLPOf07EnF5c5gyqAvbP3UZl6m72FicTS5tZnr3K8vTH5UoLkA@cipher.nrlssc.navy.mil","threadId":"27915","inReplyTo":"CAG3eYYRdvi-JdPfZmH_1EhEpjdweZFc6NS54btEz0nWy=O3+vA@mail.gmail.com","subject":"Re: Surprise at git stash pop","fromName":"Brandon Casey","fromEmail":"brandon.casey.ctr@nrlssc.navy.mil","sentAt":"2011-07-25T17:55:52Z","receivedAt":"2011-07-25T17:55:52Z","isPatch":false,"sender":{"key":"brandon.casey.ctr@nrlssc.navy.mil","avatar":null},"body":"On 07/25/2011 10:45 AM, Péter András Felvégi wrote:\n> Hello,\n> \n> 'git stash pop' erased my local modifications, but not all of them.\n\nHi,\n\nI cannot reproduce this.  What version of git are you using?\n\nCan you produce a test case?  This could be a test repo that\nyou can share or a sequence of commands to produce such a\nrepo like:\n\n   git init &&\n   echo 'Some content' >build-configs.def &&\n   mkdir -p 'server/plugins-src/ads' &&\n   echo 'Some other content' >server/plugins-src/ads/AdsPlugin.hpp &&\n   ...\n   git add . &&\n   git commit -m 'initial commit' &&\n   echo 'Some new content for build-configs' >>build-configs.def &&\n   ...\n   git stash pop\n   # Error situation\n\nThanks,\n-Brandon\n"},{"id":"172042","messageId":"CAG3eYYR3PnGYJohAwTfDD24QKqgsaoW_i7v5FS0vqyXS6udF_w@mail.gmail.com","threadId":"27915","inReplyTo":"5fuhYLPOf07EnF5c5gyqAvbP3UZl6m72FicTS5tZnr3K8vTH5UoLkA@cipher.nrlssc.navy.mil","subject":"Re: Surprise at git stash pop","fromName":"Péter András Felvégi","fromEmail":"petschy@gmail.com","sentAt":"2011-07-26T09:26:06Z","receivedAt":"2011-07-26T09:26:06Z","isPatch":false,"sender":{"key":"petschy@gmail.com","avatar":null},"body":"Hello,\n\n2011/7/25 Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil>:\n> On 07/25/2011 10:45 AM, Péter András Felvégi wrote:\n>> Hello,\n>>\n>> 'git stash pop' erased my local modifications, but not all of them.\n>\n> Hi,\n>\n> I cannot reproduce this.  What version of git are you using?\n\ngit 1.7.5.4 on Debian Wheezy AMD64\n\n>\n> Can you produce a test case?  This could be a test repo that\n> you can share or a sequence of commands to produce such a\n> repo like:\n\nNot likely, but I will try. My repo started as CVS, then converted to\nSVN, and about a year ago, I switched to GIT. It has 5+ years of\nhistory, 9k+ commits, multiple branches, merges.\n\nWhat I checked so far is that:\n- the stash on 089709b I was popping is of 2011.03.01\n- since then, a lot of commits and fast forward merges were done on the branch\n- there were some rebase -i's to squash commits together, but I was\ncareful not to alter commits already pushed to the central repo\n\nSince yesterday, I found out that my branch diverged:\n\n# Your branch and 'origin/20110207-oracle' have diverged,\n# and have 11 and 9 different commit(s) each, respectively.\n\nI don't know how can this happen, because I only pull/push to/from the\ncentral repo, and noone else is using it.\n\nWhen I pulled, there were merge conflicts, earlier versions of the\nfiles showing up. There were 3 files, SQLQueryCache cpp/hpp and\nAdsPlugin.cpp. I resolved the commits by keeping the HEAD versions.\n\nWhat is interesting is that the stash item that caused the problems is\nstill there, despite that it was popped:\n\n$ git stash list\nstash@{0}: WIP on 20110207-oracle: 089709b Merge branch\n'20110207-oracle' of ssh://... into 20110207-oracle\n\n$ git stash show\n build-configs.def |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\nI made a copy of my local repo, and the central one, too, but I don't\nreally know what to do now. The state of the repo before the pop is\nlost, unfortunately.\n\nIs there some option for git to log its actions, so that in cases like\nthis one could check on the inner workings?\n\nRegards, Peter\n"}]}