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

Re: git stash pop not reapplying deletions

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2010, 02:17 UTC
Message-ID
<7v7hqdrkjb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201002142308.01704.trast@student.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
Show 6 quoted lines
> The problem is that you aren't using --index, but still expecting it
> to restore your index.  If you change it to 'git stash pop --index',
> everything will work as expected.
>
> Yes, it does stage new files, but that is only to help you: otherwise
> you could forget them before committing.

I think the reason _new_ files are added is simply because ack then there was no other way to make it tracked.

A sane thing to do these days might be to add a newly created file with the "intent to add" option, to mimic the way other files in the work tree with changes are unstashed. They get the full change in the work tree, without restoring what their corresponding index entry used to have when the stash was made, if you unstash without the --index option.

Previous: Steve Folly
Message 8 of 8 in “git stash pop not reapplying deletions”
  1. Steve FollyFeb 14, 2010
  2. Thomas RastFeb 14, 2010
  3. Steve FollyFeb 15, 2010
  4. Thomas RastFeb 15, 2010
  5. stash pop: remove 'apply' options during 'drop' invocationThomas Rast, Feb 15, 2010
  6. Stephen BoydFeb 15, 2010
  7. Steve FollyFeb 15, 2010
  8. Junio C HamanoFeb 16, 2010

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.