Quantcast
Channel: Why can't I directly edit staged changes in the git index with VS Code? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Why can't I directly edit staged changes in the git index with VS Code?

$
0
0

I am using VS Code, and I am constantly annoyed when I find a typo in a staged change just before a commit (usually in the read-only "(Index)" editor). Because resolving it involves opening the original file, finding the same location, making the change, saving the file, now opening the diff of the file, staging this change (and none of the others), then finalizing the commit. This seems unnecessary complicated to me.

I would just like to make edits to the index - a smart editor such as VS Code should be able to do what's necessary in the background. But it won't let me since the editor is read-only, and I "Cannot edit in read-only editor"

There is a GitHub issue#91065 (and #91274, #74149, #15785, #33681) on this, saying this works "as designed". But the explanation does not really explain it to me:

The title of the diff says (Index) - this means you have staged the changes, and you are diffing the staged changes against the head revision.

Correct, but that does not explain why VS Code should not be able to stage further changes.

This is not the same as the working file, because you can selectively stage some parts of the file, so the stage version may look different to the working file

Again: correct, but that does not explain why VS Code should not be able to stage further changes without going through the hassle of editing the "working file" first.

You cannot edit the right side because the changes are staged

That's not an explanation to me.

you need to edit the working file and stage those changes as well, or unstage and edit the file

And finally, again, I don't see why VS Code could not do that for me.

But maybe I am overlooking something. So my question is,

Why can I not directly stage changes? Should VS Code be able to?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images