{"thread":{"id":"60797","subject":"git-for-windows: Rarely, checking out a branch will fast-forward that branch to the branch that was just switched from","startedAt":"2024-01-26T20:17:49Z","lastAt":"2024-01-26T20:17:49Z","messageCount":1,"participants":["Stan Stanislaus"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"487423","messageId":"CAOa6pvGV6Uu+N8tt73vaWgx7trgppFB6Hb_W-Wo8e39MMbJ6Og@mail.gmail.com","threadId":"60797","inReplyTo":null,"subject":"git-for-windows: Rarely, checking out a branch will fast-forward that branch to the branch that was just switched from","fromName":"Stan Stanislaus","fromEmail":"islaus@gmail.com","sentAt":"2024-01-26T20:17:39Z","receivedAt":"2024-01-26T20:17:49Z","isPatch":false,"sender":{"key":"islaus@gmail.com","avatar":null},"body":"- [x] I was not able to find an open or closed issue matching what I'm seeing\n\nSetup\n\nWhich version of Git for Windows are you using? Is it 32-bit or 64-bit?\n\n$ git --version --build-options\n\ngit version 2.40.0.windows.1\nC:\\Users\\StanStanislaus> git --version --build-options\ngit version 2.40.0.windows.1\ncpu: x86_64\nbuilt from commit: 1d90ca2906dd4b7ddaf0669a13c173ec579d794a\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\n\nWhich version of Windows are you running? Vista, 7, 8, 10? Is it\n32-bit or 64-bit?\ngit version 2.40.0.windows.1 Since it's in the Program Files folder\nand not the Program Files (x86) folder I'm going to say 64-bit.\n\n$ cmd.exe /c ver\n\n** Microsoft Windows [Version 10.0.22631.2861] **\n\nWhat options did you set as part of the installation? Or did you choose the\ndefaults?\n\n# One of the following:\n> type \"C:\\Program Files\\Git\\etc\\install-options.txt\"\n> type \"C:\\Program Files (x86)\\Git\\etc\\install-options.txt\"\n> type \"%USERPROFILE%\\AppData\\Local\\Programs\\Git\\etc\\install-options.txt\"\n> type \"$env:USERPROFILE\\AppData\\Local\\Programs\\Git\\etc\\install-options.txt\"\n$ cat /etc/install-options.txt\n\n** Editor Option: VIM\nCustom Editor Path:\nDefault Branch Option:\nPath Option: Cmd\nSSH Option: OpenSSH\nTortoise Option: false\nCURL Option: OpenSSL\nCRLF Option: CRLFAlways\nBash Terminal Option: MinTTY\nGit Pull Behavior Option: Merge\nUse Credential Manager: Enabled\nPerformance Tweaks FSCache: Enabled\nEnable Symlinks: Disabled\nEnable Pseudo Console Support: Disabled\nEnable FSMonitor: Disabled\n **\n\nAny other interesting things about your environment that might be related\nto the issue you're seeing?\n\n** Using poshgit for PS **\n\nDetails\n\nWhich terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other\n\n** PS **\n\nWhat commands did you run to trigger this issue? If you can provide a\nMinimal, Complete, and Verifiable example\nthis will help us understand the issue.\n\n# m => git stash; git checkout main; git pull\nfunction Invoke-Git-Stash-Pull-Main {\n    $ErrorActionPreference = \"Stop\"\n    & git stash\n    & git checkout main\n    & git pull\n    Write-Host Ran $MyInvocation.MyCommand from `$profile\n}\nNew-Alias -Name m -Value Invoke-Git-Stash-Pull-Main\n\nI'm on: git version 2.40.0.windows.1**\n\nWhat did you expect to occur after running these commands?\n\n** I expected the main branch to be checked out in the same state I left it.**\n\nWhat actually happened instead?\n\nVery intermittently and not consistently reproducibly, main is checked\nout but fast-forwarded to the state of the branch I just left by\nchecking main out. This issue seems to be the main issue here, too:\nmhutchie/vscode-git-graph#284\n\nI also posted this on the github.com/git-for-windows repo:\nhttps://github.com/git-for-windows/git/issues/4778\n\n═══════════════════\n  Stan (David) G. Stanislaus\n═══════════════════\n"}]}