0

I've just tried to unstash changes and git reported a conflict:

Auto-merging core/scaldi/modules.scala
CONFLICT (content): Merge conflict in core/scaldi/modules.scala

I'm curious as to why this conflict occurs, since I have no changes neither in working directory nor in the index:

git diff          #outputs nothing
git diff --cached #outputs nothing
git status        #outputs `nothing to commit, working directory clean`
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488

2 Answers2

3

'm curious as to why this conflict occurs, since I have no changes neither in working directory nor in the index:

It's not enough. Seems you stashed changes some commits ago.

Assume your tree looks like this:

A------B------C------D[master]
        \                
         stashed -------^ (stash apply)
         sources

So stashed file changes of core/scaldi/modules.scala conflicts with some changes in C or D.

phts
  • 3,889
  • 1
  • 19
  • 31
  • thanks, how is determined whether stash will apply cleanly or not? in the same way as a 3-way merge? Can you please elaborate on this? – Max Koretskyi Apr 01 '15 at 13:37
0

Solution that worked for me.

Imagine you were working in branch feature/abc

  1. Switch to develop branch. Fetch and Pull from develop branch.
  2. Go back to feature/abc branch. Rebase feature/abc changes onto develop.
  3. Apply stash again. It should work now.
Tung Fam
  • 7,899
  • 4
  • 56
  • 63