Let us say, you are working with Visual Studio Code on a file f1.md
in git branch-1
and then you switch to branch-2
that does not contain the file.
You get distracted because someone pinged you to ask you a question or you had to attend that mind-numbing meeting; two hours later you get back to Visual Studio Code.
Because you switched contexts, you forgot you switched branches and now you think you are on branch-1
and edit f1.md
without looking at the top or which branch you are on because the "open editor" still shows it.
Let us say you have another interruption and this time you really make changes on a file f2.md
in branch-2
.
Sometime later, you do a git add -A
and commit
and push to branch-2. Now branch-2 has file f1.md which should never have been there.
Why does "Open Editors" remember the files being edited when I was on branch-1
? This is somewhat dangerous. The "Open Editors" probably should remember the files open for a specific branch and not universally across all branches.
One can argue that we should stay away from git add -A
as it adds both tracked and untracked files. But still, it seems reasonable to expect "Open Editors" to remember files specific to a branch and not display files edited in other branches purely from a UX point of view.