Change:
I found issue that when switching to branch beggining from capital letter there is different treated by VS code plugin VS code version: Version: 1.77.1 (user setup) Commit: Date: 2023-04-04T23:21:11.906Z Electron: 19.1.11 Chromium: 102.0.5005.196 16.14.2 V8: 10.2.154.26-electron.0 OS: WindowsNT x64 10.0. Sandboxed: No Git extension version: v1.0.0 and is bulit-in Git version: 40.0.windows.1 Let's describe it: created new branch in project 'feature/case-sensitive-issue' switched to new branch: staged and commited on new branch: could see commit and I was able to undo commit from button or conext menu ! switched to smae branch, but with upper-case in "Feature" path part: could not undo my commit from button: ! After try to undo commit from context menu I had warning: ! tried to undo commit using git api: It laready worked! ! tried to commit last changes again and it worked and was commited to branch "feature/case-sensitive-issue" although I was on branch "Feature/case-sensitive-issue". ! I don't know where is the problem: in git api or in git extension. Please help me with this issue and fix it. Regards, Michal
Branches view on your screenshots is most likely from GitLens extension, not built-in Git. Check if you have GitLens extension and if it's available if you disable it. Most likely this should be reported there first.
thnank you for your suggestion. You was right, screens are from gitlens extension, except one with warning "Can't undo because HEAD doesn't point to any commit". This is from Git built-in extension. After disabling gitlens I successfully reproduced described warning.
The "Can't undo because HEAD doesn't point to any commit" error is caused by the fact that we cannot get the details of the current branch when incorrect casing is used. This is due to the fact that we are not calling with the option. On Windows and macOS branch names are case-insensitive while on Linux and they are case sensitive. Closing a repository on Windows that contains branch names that only differ by case, will result in only one branch being pulled. One potential solution would be that on Windows and macOS we include the flag.

Discussion:
import { EventEmitter } from 'events'; import * as iconv from '@vscode/iconv-lite-umd'; import * as filetype from 'file-type'; <del> import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter, Versions, isWindows, pathEquals } from './util'; </del> <ins> import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter, Versions, isWindows, pathEquals, isMacintosh } from './util'; </ins> import { CancellationError, CancellationToken, ConfigurationChangeEvent, LogOutputChannel, Progress, Uri, workspace } from 'vscode'; import { detectEncoding } from './encoding'; import { Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, RefQuery, InitOptions } from './api/git';

args.push('--format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref)'); } <ins> // On Windows and macOS ref names are case insensitive so we add --ignore-case // to handle the scenario where the user switched to a branch with incorrect // casing if (isWindows || isMacintosh) { args.push('--ignore-case'); } </ins> if (/^refs/(head|remotes)//i.test(name)) { args.push(name); } else {