From: Hosam Aly Date: Wed, 24 Sep 2025 15:29:57 GMT Subject: Bug report: Untracked file lost from git stash Message-ID: Hello, Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) I have a file in one directory. I made many changes _and_ moved it to a different directory, but that caused git to lose track of the renaming due to a low similarity index. As such, I decided to do it in two steps and used `git stash -u` to shelve my changes. Following that, I moved the file and then tried to unstash it, assuming that the worst that could happen would be a conflict that I would easily solve. ``` git init . mkdir d1 d2 echo code1 > d1/f git add d1/f git commit -m 'Add file in d1' mv d1/f d2/ echo code2 > d2/f git stash -u git stash show --stat git mv d1/f d2/ git commit -m 'Move file to d2' echo code3 > d2/f git stash pop ``` What did you expect to happen? (Expected behavior) * `git stash show` should show a file that was deleted and another that is untracked and has different contents. * `git stash pop` should apply the changes, potentially with the conflict markers. What happened instead? (Actual behavior) * The stash shows the deleted file but not the untracked one! ``` d1/f | 1 - 1 file changed, 1 deletion(-) ``` * `git stash pop` says it's unable to restore the untracked file. What's different between what you expected and what actually happened? * The stash entry doesn't show the untracked file. It should show it (or refuse to create the stash). * Trying `git checkout 'stash@{0}' -- d2/f` says it doesn't know about the file. Anything else you want to add: I seem to have lost the changes I made (symbolized by code2 above). I wasn't able to restore them using any of the git commands that I know. I'm no expert but I'm the best in my company at using Git, and yet I wasn't able to restore code2 using any git commands. Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.51.0 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon libcurl: 8.7.1 zlib: 1.2.12 SHA-1: SHA1_DC SHA-256: SHA256_BLK default-ref-format: files default-hash: sha1 uname: Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Aug 11 21:15:09 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6041 arm64 compiler info: clang: 17.0.0 (clang-1700.0.13.3) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh [Enabled Hooks]