git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Confusing `stash apply` behavior
@ 2009-03-10 19:46 Tim Visher
  2009-03-11 10:02 ` Nanako Shiraishi
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Visher @ 2009-03-10 19:46 UTC (permalink / raw
  To: git

Hello Everyone,

I was just trying to do some experimentation with `stash` and I've run
into a problem.

I was working on my `master` branch and decided that I wanted to
create a `dev` branch.  I did `git stash` and then `git checkout -b
dev`.  Then I did `git stash apply` and everything worked as expected.
 I continued working but then realized that I wanted a `refactoring`
branch.  In the process of continuing to work I had also cleared the
stash stack with `git stash clear`, although this had no visible
effect other than to remove any entries from `git stash list`.  As
before, I did `git stash` and then `git checkout -b refactoring` and
here lies my problem.

When I do `git stash apply`, it deletes the file I'm working with.

    $ ls
    featureList.txt*  keycontrol.mdb*

    $ git show stash@{0}
    commit b3c0f4b9b3c3ef7741a03fb27174f5838abc939d
    Merge: 9fb9886 112bba9
    Author: Tim Visher <timothy.visher@fms.treas.gov>
    Date:   Tue Mar 10 15:25:04 2009 -0400

    WIP on dev: 9fb9886 Added DB Lock file to .gitignore. EOM

    diff --cc keycontrol.mdb
    index 68a9bac,68a9bac..0000000
    --- a/keycontrol.mdb
    +++ b/keycontrol.mdb

    $ git stash apply
    Removing keycontrol.mdb
    # On branch refactoring
    # Changed but not updated:
    #   (use "git add/rm <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working
directory)
    #
    #       deleted:    keycontrol.mdb
    #
    no changes added to commit (use "git add" and/or "git commit -a")

Considering the output of `git show` I would expect that the contents
of the stash are, well, what I expect them to be: a new version of
keycontrol.mdb.

I'm sure I'm missing something completely juvenile but I could really
use some help because that stash represents about an hours worth of
work.  Not something to totally loose sleep over but something that
would be nicer to not have to do over.

Thanks in advance for your help!

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Confusing `stash apply` behavior
  2009-03-10 19:46 Confusing `stash apply` behavior Tim Visher
@ 2009-03-11 10:02 ` Nanako Shiraishi
  2009-03-11 12:45   ` Tim Visher
  0 siblings, 1 reply; 3+ messages in thread
From: Nanako Shiraishi @ 2009-03-11 10:02 UTC (permalink / raw
  To: Tim Visher; +Cc: git

Quoting Tim Visher <tim.visher@gmail.com>:

> When I do `git stash apply`, it deletes the file I'm working with.
>
>     $ ls
>     featureList.txt*  keycontrol.mdb*
>
>     $ git show stash@{0}
>     commit b3c0f4b9b3c3ef7741a03fb27174f5838abc939d
>     Merge: 9fb9886 112bba9
>     Author: Tim Visher <timothy.visher@fms.treas.gov>
>     Date:   Tue Mar 10 15:25:04 2009 -0400
>
>     WIP on dev: 9fb9886 Added DB Lock file to .gitignore. EOM
>
>     diff --cc keycontrol.mdb
>     index 68a9bac,68a9bac..0000000
>     --- a/keycontrol.mdb
>     +++ b/keycontrol.mdb
>
>     $ git stash apply
>     Removing keycontrol.mdb
>     # On branch refactoring
>     # Changed but not updated:
>     #   (use "git add/rm <file>..." to update what will be committed)
>     #   (use "git checkout -- <file>..." to discard changes in working
> directory)
>     #
>     #       deleted:    keycontrol.mdb
>     #
>     no changes added to commit (use "git add" and/or "git commit -a")
>
> Considering the output of `git show` I would expect that the contents
> of the stash are, well, what I expect them to be: a new version of
> keycontrol.mdb.

The 'index' line in your 'diff --cc' output says that back when you created that stash, the HEAD and your index both held a blob object 68a9bac and your working tree didn't have that file, ie, removed. It is very natural that the file is removed when you apply that stash.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Confusing `stash apply` behavior
  2009-03-11 10:02 ` Nanako Shiraishi
@ 2009-03-11 12:45   ` Tim Visher
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Visher @ 2009-03-11 12:45 UTC (permalink / raw
  To: Nanako Shiraishi; +Cc: git

On Wed, Mar 11, 2009 at 6:02 AM, Nanako Shiraishi <nanako3@lavabit.com> wrote:
> Quoting Tim Visher <tim.visher@gmail.com>:
>
>> When I do `git stash apply`, it deletes the file I'm working with.
>>
>>     $ ls
>>     featureList.txt*  keycontrol.mdb*
>>
>>     $ git show stash@{0}
>>     commit b3c0f4b9b3c3ef7741a03fb27174f5838abc939d
>>     Merge: 9fb9886 112bba9
>>     Author: Tim Visher <timothy.visher@fms.treas.gov>
>>     Date:   Tue Mar 10 15:25:04 2009 -0400
>>
>>     WIP on dev: 9fb9886 Added DB Lock file to .gitignore. EOM
>>
>>     diff --cc keycontrol.mdb
>>     index 68a9bac,68a9bac..0000000
>>     --- a/keycontrol.mdb
>>     +++ b/keycontrol.mdb
>>
>>     $ git stash apply
>>     Removing keycontrol.mdb
>>     # On branch refactoring
>>     # Changed but not updated:
>>     #   (use "git add/rm <file>..." to update what will be committed)
>>     #   (use "git checkout -- <file>..." to discard changes in working
>> directory)
>>     #
>>     #       deleted:    keycontrol.mdb
>>     #
>>     no changes added to commit (use "git add" and/or "git commit -a")
>>
>> Considering the output of `git show` I would expect that the contents
>> of the stash are, well, what I expect them to be: a new version of
>> keycontrol.mdb.
>
> The 'index' line in your 'diff --cc' output says that back when you created that stash, the HEAD and your index both held a blob object 68a9bac and your working tree didn't have that file, ie, removed. It is very natural that the file is removed when you apply that stash.

Huh.  I don't know how that would have happened, but I guess I should
have been more careful with the stash command.  Oh well.

Thanks for your help!

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-11 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-10 19:46 Confusing `stash apply` behavior Tim Visher
2009-03-11 10:02 ` Nanako Shiraishi
2009-03-11 12:45   ` Tim Visher

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).