git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-for-windows: Rarely, checking out a branch will fast-forward that branch to the branch that was just switched from

From
SSStan 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-Main
I'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
═══════════════════
Message 1 of 1 in “git-for-windows: Rarely, checking out a branch will fast-forward that branch to the branch that was just switched from”
  1. Stan StanislausJan 26, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.