git-for-windows: Rarely, checking out a branch will fast-forward that branch to the branch that was just switched from
- From
- Stan Stanislaus <islaus@gmail.com>
- Date
- Jan 26, 2024, 20:17 UTC
- Message-ID
- <CAOa6pvGV6Uu+N8tt73vaWgx7trgppFB6Hb_W-Wo8e39MMbJ6Og@mail.gmail.com>
- [x] I was not able to find an open or closed issue matching what I'm seeing
Setup
Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.40.0.windows.1 C:\Users\StanStanislaus> git --version --build-options git version 2.40.0.windows.1 cpu: x86_64 built from commit: 1d90ca2906dd4b7ddaf0669a13c173ec579d794a sizeof-long: 4 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon
Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit? git version 2.40.0.windows.1 Since it's in the Program Files folder and not the Program Files (x86) folder I'm going to say 64-bit.
$ cmd.exe /c ver
** Microsoft Windows [Version 10.0.22631.2861] **
What options did you set as part of the installation? Or did you choose the defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt" > type "C:\Program Files (x86)\Git\etc\install-options.txt" > type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt" > type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt
** Editor Option: VIM Custom Editor Path: Default Branch Option: Path Option: Cmd SSH Option: OpenSSH Tortoise Option: false CURL Option: OpenSSL CRLF Option: CRLFAlways Bash Terminal Option: MinTTY Git Pull Behavior Option: Merge Use Credential Manager: Enabled Performance Tweaks FSCache: Enabled Enable Symlinks: Disabled Enable Pseudo Console Support: Disabled Enable FSMonitor: Disabled **
Any other interesting things about your environment that might be related to the issue you're seeing?
** Using poshgit for PS **
Details
Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other
** PS **
What commands did you run to trigger this issue? If you can provide a Minimal, Complete, and Verifiable example this will help us understand the issue.
# m => git stash; git checkout main; git pull
function Invoke-Git-Stash-Pull-Main {
$ErrorActionPreference = "Stop"
& git stash
& git checkout main
& git pull
Write-Host Ran $MyInvocation.MyCommand from `$profile
}
New-Alias -Name m -Value Invoke-Git-Stash-Pull-MainI'm on: git version 2.40.0.windows.1**
What did you expect to occur after running these commands?
** I expected the main branch to be checked out in the same state I left it.**
What actually happened instead?
Very intermittently and not consistently reproducibly, main is checked out but fast-forwarded to the state of the branch I just left by checking main out. This issue seems to be the main issue here, too: mhutchie/vscode-git-graph#284
I also posted this on the github.com/git-for-windows repo: https://github.com/git-for-windows/git/issues/4778
═══════════════════ Stan (David) G. Stanislaus ═══════════════════