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

git stash deletes/drops changes of "assume-unchanged" files

From
Adeodato Simó <dato@net.com.org.es>
Date
Jun 4, 2010, 16:24 UTC
Message-ID
<AANLkTin-BIxgQE5CO2cLhCYJAGHFxiXPquyozKc308DS@mail.gmail.com>
Hello (and please CC me on replies).

I was unpleasantly surprised to discover yesterday that doing `git stash` on a repository where I had previously run `git update-index --assume-unchanged FOO` completely lost all changes I had in file FOO.

I understand the behavior is logical from the way git-stash is implemented, but it strikes as very undesirable behavior to me. Does somebody think something could be done to change it? In my opinion, both including in the stash changes in FOO, or just leaving them in the working tree, would be better alternatives.

Thoughts?
-8<-

% git init % echo file1 contents >file1; echo file2 contents >file2 % git add file1 file2; git commit -m Initial.

% echo changes for file2 >>file2 % echo some other changes to file 1 >>file1 % git update-index --assume-unchanged file1

% git stash % cat file1 file1 contents % git stash show -p

--- a/file2
+++ b/file2
@@ -1 +1,2 @@
 file2 contents
+changes for file2

-8<-
-- 
- Are you sure we're good?
- Always.
        -- Rory and Lorelai
Next: Jim Greenleaf
Message 1 of 20 in “git stash deletes/drops changes of "assume-unchanged" files”
  1. Adeodato SimóJun 4, 2010
  2. Jim GreenleafMay 23, 2013
  3. Thomas RastMay 23, 2013
  4. Junio C HamanoMay 23, 2013
  5. Thomas RastMay 23, 2013
  6. Junio C HamanoMay 23, 2013
  7. Phil HordMay 24, 2013
  8. Jim GreenleafMay 24, 2013
  9. John KeepingMay 24, 2013
  10. Jim GreenleafMay 24, 2013
  11. John KeepingMay 24, 2013
  12. Petr BaudisMay 23, 2013
  13. John KeepingMay 24, 2013
  14. Petr BaudisMay 24, 2013
  15. John KeepingMay 24, 2013
  16. Petr BaudisMay 24, 2013
  17. John KeepingMay 24, 2013
  18. Petr BaudisMay 24, 2013
  19. John KeepingMay 24, 2013
  20. Stephen BashMay 24, 2013

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.