VSCode shows pending changes from another branch

Viewed 607

I started using VSCode's built-in version control feature recently. I made changes to two files while I was in a given branch (let's call it bug-39) and then switched to another one (let's say bug-40) with git checkout bug-40.

When I re-launched VSCode afterwards, I verified I was in bug-40 (in the bottom left corner of the screen) but the pending changes section still listed the two files I had modified while in bug-39.

Is this normal, or perhaps I did something wrong and didn't save the files in bug-39 but instead "globally"?

1 Answers

You are missing a git commit before switching branch.

The changes are then "carried" to the new branch, so that you may commit them there.

Is this normal, or perhaps I did something wrong and didn't save the files in bug-39 but instead "globally"?

In the end, this is normal. You didn't do anything wrong, just something not intended. There is no such concept in git as "saved globally".

Related