Re: How do I resolve conflict after popping stash without adding the file to index?
- From
Dmitry Gutov <dgutov@yandex.ru>
- Date
- Apr 21, 2015, 22:35 UTC
- Message-ID
- <5536D099.1000103@yandex.ru>
- In-Reply-To
- <20150421212922.GC13230@peff.net>
On 04/22/2015 12:29 AM, Jeff King wrote:
Show 11 quoted lines
> Hmm, interestingly, if you do _not_ stage the changes (i.e., drop the > final "git add" there), you get: > > $ git stash pop > error: Your local changes to the following files would be overwritten by merge: > test > Please, commit your changes or stash them before you can merge. > Aborting > > which makes sense. Writing conflict markers into the file would leave > you in a situation where it is hard to recover the "bbbbb" content.
Indeed.
Show 5 quoted lines
> But we seem to skip that safety valve when the content has been staged, > which seems questionable to me (technically we are slightly better off > than the protected case because "bbbbb" was written to a git blob > object, so you can recover it. But it may be difficult to find the > correct blob in the object database).
Any suggestions how to restore that content in the index programmatically? If it's non-trivial to do, maybe that is indeed a bug, and 'git stash pop' should abort before creating the conflict.