git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Confusing `stash apply` behavior

From
Nanako Shiraishi <nanako3@lavabit.com>
Date
Mar 11, 2009, 10:02 UTC
Message-ID
<20090311190217.6117@nanako3.lavabit.com>
In-Reply-To
<c115fd3c0903101246n1eff50d4rc819e5fe7586a974@mail.gmail.com>
Quoting Tim Visher <tim.visher@gmail.com>:
Show 33 quoted lines
> 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/
Previous: Tim VisherNext: Tim Visher
Message 2 of 3 in “Confusing `stash apply` behavior”
  1. Tim VisherMar 10, 2009
  2. Nanako ShiraishiMar 11, 2009
  3. Tim VisherMar 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.