Re: [git-users] git stash restores some, but not all, changes

2014-12-11 Thread Dale R. Worley
Fortunately, "git diff stash@{0}" will probably show the differences
between the stashed files and your current working directory.  It seems
like Git is smart enough to know that the stash-pop is failing and not
delete record of the top stash.

But it does sound like there are a number of bugs in git-stash.

Dale

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] git stash restores some, but not all, changes

2014-12-10 Thread Damion Moyer


While working on Branch A, a fire erupted in the office that required 
extinguishing. I did not yet want to commit my changes. I had added 2 new 
files, and altered 7. None of the changes were staged. I wanted to 
temporarily stash my changes, and used 'git stash -a'. What I'd really 
wanted was the -u switch, but erroneously used -a. My entire project was 
stashed and my branch was, as expected, restored to the last commit.

I switched to Branch B, did some work, and committed it.

I then switched back to Branch A, and called 'git stash pop'. Many 
repetitive lines scrolled by reading "[filename] already exists, no 
checkout", and then finalizing with the message "Could not restore 
untracked files from stash". Examination of my branch showed that the 2 
untracked files HAD been restored, but the 7 altered ones had not. 'git 
status' shows 2 untracked files, and no other changes. Because I'd stashed 
the entire project, there are roughly 1500 files being compared, so I don't 
know what the result of the comparison with the 7 altered files shows... it 
scrolls off the buffer.

'git stash list' shows that there is still an entry in the stash: 
"stash@{0}: WIP on Branch A: ffef125 [last commit message]"

'git stash show' does indeed show my 7 changed files in the stash, but when 
I 'git stash pop', those files are not restored, and the entry remains in 
the stash (which is not consistent with my expectations for pop)

I also attempted to reset the branch with 'git reset --hard' and THEN apply 
the stash, but I got the same results... untracked files were restored, 
while tracked files were not.

I'd wondered if there'd been some kind of merge conflict with the 7 altered 
files, but there are no conflict resolution markers in any of them.

Why can I not restore my 7 altered files, and what's the workaround? And on 
a side note, why does git say that it could not restore the untracked 
files, when in fact those are the things that WERE restored?

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.