Surprise at git stash pop
- From
- Pé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