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

git stash usage

From
NSNikodemus Siivola <nikodemus@random-state.net>
Date
Sep 6, 2007, 14:20 UTC
Message-ID
<6bcc356f0709060720x257aff95x783463c5b23f0b7a@mail.gmail.com>
I'm not sure if I understand git-stash correctly.
 ...work...
 git stash
 ...quick fix & commit...
 git stash apply
 ...more work...

is my understanding of the normal workflow. If this is correct, why does "apply" leave the stash in the list of stashes?

  mkdir git-stash-test
  cd git-stash-test
  git init
  echo foo > save-apply-test.txt
  git add save-apply-test.txt
  git commit -m "foo"
  echo bar > save-apply-test.txt
  git stash
  echo quux > save-apply-test.txt
  git commit -a -m "quux"
  git stash apply
  git commit -a -m "bar"
  # I would expect the list to be empty now, but it isn't.
  git stash list
Is this intentional?

It's a bit inconvenient, especially considering that "clear" removes all the stashes.

I can easily accumulate several stashes, some of which are applied and some of which are not -- but have no way to easily know which are which.

Cheers,
 -- Nikodemus
Message 1 of 1 in “git stash usage”
  1. Nikodemus SiivolaSep 6, 2007

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.