{"thread":{"id":"65990","subject":"local mistake - need help in recover","startedAt":"2026-07-14T04:05:04Z","lastAt":"2026-07-14T22:27:55Z","messageCount":2,"participants":["N.S Kishore","D. Ben Knoble"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"548071","messageId":"MA0PR01MB9857F8757F67BD2F8FF358CF97F92@MA0PR01MB9857.INDPRD01.PROD.OUTLOOK.COM","threadId":"65990","inReplyTo":null,"subject":"local mistake - need help in recover","fromName":"N.S Kishore","fromEmail":"n.s.kishore@cctech.co.in","sentAt":"2026-07-14T04:04:59Z","receivedAt":"2026-07-14T04:05:04Z","isPatch":false,"body":"Hi Team,\n\nNeed help to recover files from local mistake.\n\nRegards,\nKishore N S.\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\n1. Working on a feature branch with several documentation files.\n2. HEAD contained only a subset of those files (already committed earlier).\n3. Created additional files locally and edited existing ones.\n4. Staged the new and modified files with `git add` from the IDE (VS Code / Cursor Git extension), over a period of roughly 20–30 minutes.\n5. Did NOT commit before doing other git operations.\n6. Later ran `git merge <remote-branch>` into the feature branch. Reflog also shows a `reset: moving to HEAD` shortly before merge / branch activity.\n7. Noticed that previously staged files were no longer in the index and were not in any commit.\n\n\nWhat did you expect to happen? (Expected behavior)\n\n- Staged changes should remain in the index until explicitly unstaged, committed, or discarded.\n- `git merge` should not silently drop unrelated staged-but-uncommitted work.\n- Staged files should still appear under \"Changes to be committed\" after the merge.\n- The IDE should continue to show staged files and allow commit.\n\n\nWhat happened instead? (Actual behavior)\n\n- After merge (and/or related operations in the same session), staged files disappeared from the index.\n- `git status` no longer listed the files as staged.\n- New files that had been `git add`ed were untracked again or missing from staging.\n- The IDE logged warnings like \"File not found\" when comparing against HEAD, because those paths only existed in the index, not in any commit.\n- At one point, index entries for staged files suddenly disappeared (visible in IDE Git logs).\n- File content was not fully lost: blobs were recoverable via `git fsck --lost-found` and `.git/lost-found/other/`, but manual recovery was required (copy blobs, re-apply edits, recommit).\n\n\nWhat's different between what you expected and what actually happened?\n\nExpected: staging is a safe holding area until commit; merge should not wipe it.\nActual: staging was cleared without commit; IDE showed confusing errors; work had to be reconstructed from lost-found blobs.\n\nThe merge only touched unrelated paths (no content conflict on the staged files), yet staged work still vanished from the index.\n\n\nAnything else you want to add:\n\nEditor: Cursor (VS Code-based), Git extension used for staging.\n\nRough timeline:\n- Staged multiple files over ~20–30 minutes\n- Index entries disappeared shortly after last `git add`\n- `git reset` and `git merge` occurred in the same session\n- Recovery required copying from lost-found blobs and recommitting\n\nSuggested reproduction:\n1. Stage several NEW untracked files (not in HEAD) with `git add`.\n2. Do NOT commit.\n3. Run `git merge <other-branch>` or `git reset` / branch checkout in the same repo.\n4. Check whether the index still contains the staged new files.\n\nImpact: time lost reconstructing work; risk of data loss if blobs had been garbage-collected.\n\nWorkaround: `git fsck --lost-found`, `git show <blob>`, copy from `.git/lost-found/other/`, recommit.\n\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.54.0\ncpu: arm64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nrust: disabled\nfeature: fsmonitor--daemon\ngettext: enabled\nlibcurl: 8.7.1\nzlib: 1.2.12\nSHA-1: SHA1_DC\nSHA-256: SHA256_BLK\ndefault-ref-format: files\ndefault-hash: sha1\nuname: Darwin 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun  9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6041 arm64\ncompiler info: clang: 21.0.0 (clang-2100.0.123.102)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /bin/zsh\n\n\n[Enabled Hooks]\n"},{"id":"548170","messageId":"CALnO6CBFSY9Zj34q-P9NQwvMrJiPzS9caP2qjB5KCW3aQYz0hg@mail.gmail.com","threadId":"65990","inReplyTo":"MA0PR01MB9857F8757F67BD2F8FF358CF97F92@MA0PR01MB9857.INDPRD01.PROD.OUTLOOK.COM","subject":"Re: local mistake - need help in recover","fromName":"D. Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2026-07-14T22:27:42Z","receivedAt":"2026-07-14T22:27:55Z","isPatch":false,"body":"> Le 14 juil. 2026 à 00:06, N.S Kishore <n.s.kishore@cctech.co.in> a écrit :\n> ﻿\n> Hi Team,\n> Need help to recover files from local mistake.\n> Regards,\n> Kishore N S.\n\n> After merge (and/or related operations in the same session), staged files disappeared from the index\n\nI could only slightly reproduce the issue reported:\n\n    git init foo && cd foo\n    echo a >a && git add a && git commit -ma\n    echo a >>a && git commit -am aa\n    git switch -c b HEAD~\n    echo b >b && git add b && git commit -mb\n    echo b >>b && git add b\n    echo b >>b\n\nFrom here, « git merge main » refuses (« Your local changes to the\nfollowing files would be overwritten by merge »). With autostash mode,\nthe merge succeeds, but the staged line of b is now unstaged. The\nworking tree contents were not lost, though.\n\nIn retrospect, I didn’t try with new files on the side branch.\n\nTest performed with Git 2.53.0 and repeated with\n2.55.0.rc0.738.g0c8ab3ebcc.dirty.\n"}]}