Subject: Re: stash refuses to pop

From: Johannes Sixt <[email-masked]>
Date: Thu, 12 Apr 2012 07:50:05 +0200

Am 4/11/2012 16:21, schrieb Phillip Susi:
> On 4/11/2012 1:58 AM, Johannes Sixt wrote:
>> You are trying to abuse git-stash, but it does not cooperate because it
>> was not designed to be abused ;-) git-stash is not intended as a generic
>> push-and-pop-my-changes work horse.
> 
> In what way is using the documented -p switch abuse?

It isn't.

>> The purpose of git-stash is that you can "move away"
> 
> Yes, and then move back.

This is abuse, if you haven't cleaned your worktree.

>> That is, before you can think of applying a stash, you are expected to
>> have cleaned out your worktree.
> 
> It is obvious that is the assumption that stash was originally made with,
> and it might make some sense if it always left the tree in a clean state,
> but it no longer makes sense given -p and how it can leave the tree in a
> not clean state.

You are misunderstanding. The intended workflow is:

  stash -p
  # ... test the remaining changes in isolation ...
  commit -a
  # now the worktree is clean
  stash pop

-- Hannes