{"thread":{"id":"27783","subject":"reproducible unexpected behavior for 'git reset'","startedAt":"2011-07-10T22:02:48Z","lastAt":"2011-07-10T22:02:48Z","messageCount":1,"participants":["John Nowak"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171041","messageId":"F5C3C2A9-1A77-4E28-B4B2-508A7F8ACB7E@johnnowak.com","threadId":"27783","inReplyTo":null,"subject":"reproducible unexpected behavior for 'git reset'","fromName":"John Nowak","fromEmail":"john@johnnowak.com","sentAt":"2011-07-10T22:02:48Z","receivedAt":"2011-07-10T22:02:48Z","isPatch":false,"sender":{"key":"john@johnnowak.com","avatar":null},"body":"I am able to reproduce a scenario where, after a 'commit' and a 'stash pop' that results in a merge conflict, I need to 'reset' a file twice in order to get the index back to HEAD. It appears that the first 'reset' sets the index to the merge base version instead of HEAD which was, for me, rather unexpected. I encountered this on 1.7.4 but others have reproduced it on the latest master. If this behavior is documented, I cannot find it.\n\nA transcript to reproduce this oddity is below; note how the file is partially staged after the first 'reset' and unstaged after the second:\n\n---\n\n$ git init\nInitialized empty Git repository in /Users/jn/test/.git/\n\n$ echo \"a\" > foo\n\n$ git add foo\n\n$ git commit -a -m \"Initial\"\n[master (root-commit) 5214837] Initial\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 foo\n\n$ echo \"b\" >> foo\n\n$ git stash\nSaved working directory and index state WIP on master: 5214837 Initial\nHEAD is now at 5214837 Initial\n\n$ echo \"c\" >> foo\n\n$ git add foo\n\n$ git commit -a -m \"Added c\"\n[master 69eef48] Added c\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\n$ git stash pop\nAuto-merging foo\nCONFLICT (content): Merge conflict in foo\n\n$ git status\n# On branch master\n# Unmerged paths:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n#\n#\tboth modified:      foo\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n$ git reset foo\nUnstaged changes after reset:\nM\tfoo\n\n$ git status\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#\tmodified:   foo\n#\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tmodified:   foo\n#\n\n$ git reset foo\nUnstaged changes after reset:\nM\tfoo\n\n$ git status\n# On branch master\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tmodified:   foo\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n"}]}