{"thread":{"id":"66193","subject":"'git stash' is not atomic: it leaves both an invalid stash and file changes","startedAt":"2026-08-19T02:28:52Z","lastAt":"2026-08-19T02:28:52Z","messageCount":1,"participants":["Yuri"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"550785","messageId":"6b5dbe00-690e-402f-9f55-ba708c3a4ef5@rawbw.com","threadId":"66193","inReplyTo":null,"subject":"'git stash' is not atomic: it leaves both an invalid stash and file changes","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2026-08-19T02:17:30Z","receivedAt":"2026-08-19T02:28:52Z","isPatch":false,"body":"My repository had many untracked files that were accidentally added, one \nof them was 2GB.\nMy first attempt failed:\n$ git stash push ../../ -m \"all-accidentally-added\"\nSaved working directory and index state On main: all-accidentally-added\nfatal: unable to generate diff for misc/linux-rl9-cuda13/libcuda.txt\n\nTwo problems with this:\n1. it didn't say why did it fail to generate diff.\nIt should have said \"fatal: unable to generate diff for \nmisc/linux-rl9-cuda13/libcuda.txt: file is 2GB which is larger than the \nlimit 1GB\"\n2. This command left both stash and file changes. If the command has \nfailed, why does it leave stash then?\n\n\nAfter removing the large file 'git stash' still failed:\n$ git stash push ../../ -m \"all-accidentally-added-final\"\nSaved working directory and index state On main: \nall-accidentally-added-final\nerror: patch too large\n\nAgain: \"patch too large\" needs to specify the limit, and the transaction \nshould be atomic.\n\n\nPlease consider improving error messages to be more informative as for \nthe reasons of failure. Also please consider making stash atomic. The \nstash that was left was obviously invalid because it didn't contain at \nleast one file.\n\n\nYuri\n\n\n\n\n"}]}