{"thread":{"id":"57359","subject":"Git Bug Report: 'git stash pop' always put new files into staging area, regardless of '--index' option","startedAt":"2022-02-02T18:37:05Z","lastAt":"2022-02-02T18:37:05Z","messageCount":1,"participants":["Zhuo Cheng Du"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"447549","messageId":"CA+RO+X5sxqhB3ONx7JseHEyctYBLrzCtwofyQ4+z5cgDzQROoQ@mail.gmail.com","threadId":"57359","inReplyTo":null,"subject":"Git Bug Report: 'git stash pop' always put new files into staging area, regardless of '--index' option","fromName":"Zhuo Cheng Du","fromEmail":"zhuo@delphia.com","sentAt":"2022-02-02T18:36:51Z","receivedAt":"2022-02-02T18:37:05Z","isPatch":false,"sender":{"key":"zhuo@delphia.com","avatar":null},"body":"Hi there,\n\nPlease see attached for a bug I encountered while using 'git stash'.\nAlso, is there any bug tracker that I can subscribe to to keep me\nupdated?\n\nThanks,\n\n\n-- \n\nZhuo Cheng Du\n\nSoftware Engineer\n\nDelphia\n\n1 833-335-7442\nzhuo@delphia.com\nwww.delphia.com\n300-501 Queen St. W., Toronto, ON, M5V 2B4\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)\n1. Create a brand new file, e.g. 'touch a.py'\n2. Add it to worktree with 'git add a.py'\n3. stash the file with 'git stash'\n4. pop the stashed change with 'git stash pop', WITHOUT the --index option\nWhat did you expect to happen? (Expected behavior)\nI expect the file 'a.py' to be in unstaged area since I did not pass the '--index' option to 'git stash pop'\nWhat happened instead? (Actual behavior)\nThe file is found in staged are are after 'git stash pop', potentially causing merge-conflict in certain scenarios\nWhat's different between what you expected and what actually happened?\nI want the file to be found in unstaged area. The 'git stash push'/'git stash pop' combo works as expected if the file is already added to worktree prior to this maneuver. I think the behavior should be consistent for brand new files as well.\nAnything else you want to add:\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.31.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64\ncompiler info: clang: 12.0.0 (clang-1200.0.32.29)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /bin/zsh\n\n\n[Enabled Hooks]\n"}]}