microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.8k stars 28.44k forks source link

Auto stash after branch switch doesn't stash new files #214768

Open thany opened 2 months ago

thany commented 2 months ago

Type: Bug

When switching to another git branch, VScode offers to stash any current changes. But when I choose that option, it only stashes changed files, but leaves new files out of the stash.

It makes sense to also stash new files, because they are part of the set of changes that was being worked on, and should not accidentally become part of the branch being switched to.

So currently the changes stash only partly, which effectively splits the not-yet-committed changeset in twine, which is probably bad in most scenarios, and can lead to confusion and bugs.

To reproduce:

  1. Be on branch A
  2. Have some changed as well as some new files
  3. Checkout branch B
  4. VScode will ask what to do - choose to stash
  5. Observe the split between what's now stashed (changed files), and what isn't (new files)

After step 5, those new files will be "part of" the new branch if you're not careful in selecting what to commit.

Instead, new files should also be put into the stash that was offered in step 4.

VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:13:33.891Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i9-12900H (20 x 2918)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.68GB (13.49GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (33) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 codesnap|adp|1.3.4 jsdoc-generator|cry|2.1.0 font-preview|ctc|2.2.1 vscode-autohotkey-plus|cwe|2.7.1 vscode-eslint|dba|2.4.4 overtype|DrM|0.5.0 EditorConfig|Edi|0.16.4 vscode-great-icons|emm|2.1.105 auto-rename-tag|for|0.1.10 remotehub|Git|0.62.0 todo-tree|Gru|0.0.226 vscode-totalcommander|ipa|1.0.4 rainbow-csv|mec|3.12.0 vscode-duplicate|mrm|1.2.1 vscode-scss|mrm|0.10.0 vscode-docker|ms-|1.29.1 vscode-dotnet-runtime|ms-|2.0.5 remote-wsl|ms-|0.88.2 azure-repos|ms-|0.38.0 powershell|ms-|2024.2.2 remote-repositories|ms-|0.40.0 gremlins|nho|0.26.0 vscode-versionlens|pfl|1.13.1 prettyxml|Pra|5.0.0 prisma|Pri|5.15.0 sqlite-viewer|qwt|0.5.7 LiveServer|rit|5.7.9 sass-indented|syl|1.8.29 vscode-mdx|uni|1.8.8 vscode-svg-previewer|vit|0.7.0 volar|Vue|2.0.19 pretty-ts-errors|Yoa|0.5.4
VSCodeTriageBot commented 2 months ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.90.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

thany commented 2 months ago

Whoops, that's right. The problem still happens on 1.90.0, unfortunately.