1

The Problem

We had an external developer working on a project on a wrong branch through FTP (not working with git at all).

The fix

To reapply his (by nature, uncommitted) changes, I ran git stash, followed by git checkout [correct_branch], then git stash apply. Nothing had changed except for a single file which was not changed by him (but existed in the stash anyway).

The good ol' weirdness

Running git diff 'stash@{0}' [correct_branch] --name-only (alternatively omitting the name-only flag) shows me a correct difflist of the changed files. When running git stash apply or git stash apply 'stash@{0}', followed by git diff does not tell me that anything has changed.

What's going on here? The diff against the stash tells me that there is indeed changes in that stash that hasn't been applied to the current branch.

rdiz
  • 6,136
  • 1
  • 29
  • 41
  • The `stash` ref points to the `w`ork-tree commit in what I have taken to calling a "stash bag": http://stackoverflow.com/a/20589663/1256452 - see that answer for what git does with the `i` and `w` commits during `git stash apply`, and note that `git diff stash@{0} branch` is comparing the `w` tree to that of branch-tip `branch`. I don't see off-hand why your problem is occurring but it may be worth reading through that answer anyway. – torek Oct 29 '15 at 10:08
  • That clarified some things about stashing, so thanks even though it didn't really solve my problem (as you said)! :) – rdiz Oct 29 '15 at 10:48

0 Answers0