git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Surprise at git stash pop

From
PFPéter András Felvégi <petschy@gmail.com>
Date
Jul 25, 2011, 15:45 UTC
Message-ID
<CAG3eYYRdvi-JdPfZmH_1EhEpjdweZFc6NS54btEz0nWy=O3+vA@mail.gmail.com>
Hello,

'git stash pop' erased my local modifications, but not all of them. Here is the dump of my terminal window with comments:

1) 1 item in the stash:

petschy@stormbringer:~/...$ git stash list stash@{0}: WIP on 20110207-oracle: 089709b Merge branch '20110207-oracle' of ssh:.... into 20110207-oracle

2) the status of the working tree

petschy@stormbringer:~/...$ git status # On branch 20110207-oracle # Your branch is ahead of 'origin/20110207-oracle' by 2 commits. # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: SQLQueryCache.cpp # modified: SQLQueryCache.hpp # modified: ../../server/plugins-src/ads/AdsPlugin.cpp # modified: ../../server/plugins-src/ads/AdsPlugin.hpp

3) querying the details of the stashed item
petschy@stormbringer:~/...$ git stash show stash@{0}
 build-configs.def |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
4) popping it, naively

petschy@stormbringer:~/...$ git stash pop Auto-merging build-configs.def CONFLICT (content): Merge conflict in build-configs.def

5) surprise, surprise!

petschy@stormbringer:~/...$ git status # On branch 20110207-oracle # Your branch is ahead of 'origin/20110207-oracle' by 2 commits. # # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark resolution) # # both modified: ../../build-configs.def # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: SQLQueryCache.cpp

ALL of the local modifications to SQLQueryCache.hpp, AdsPlugin.cpp/hpp simply disappeared! Is this the expected behaviour? I don't think so. Since the stash contained only one file, which had nothing to do with the pending modifications, I thought it's safe to pop. And even if the local modifications and the stashed files overlap, I'd expect a warning, at least. Half day's work gone. And if this is business as usual, why not all my local modifications were wiped?

Regards, Peter
Next: Brandon Casey
Message 1 of 3 in “Surprise at git stash pop”
  1. Péter András FelvégiJul 25, 2011
  2. Brandon CaseyJul 25, 2011
  3. Péter András FelvégiJul 26, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.