0

When I want to Stage my changes on my branch, I click the plus sign (Stage) in Visual Studio 2019's Git Changes panel on the right side of the changed file. Usually after that the files goes in the staged section and after writing a commit message I click commit and it's done. Git Changes Panel in Visual Studio 2019 But after click the plus sign the vs asks me if I want to save the changes of the file and if I click 'save' the file just disappears from the Changes section. Without staging and committing and right after it's visible in the development branch. Without even making a Pull request. MSV Asks If I Want To Save Instead of Staging What do I miss?

I don't really know what I can try. I have changed branches, I have deleted and created new branch. It feels like I messed up some sort of settings. I have no idea honestly.

M3VRIX
  • 9
  • 3
  • Your description is a little unclear. Are you trying to commit or just stage? The message you see about saving changes is not related to git, it is just VS saying your files aren't saved (usually you DO want to save your files before you commit or stage). – topsail Feb 14 '23 at 20:00
  • Yes I know that's why I don't understand it. Because I see this message when I click the plus icon. I want to commit in first hand but it's not significant since I can't without staging the changes first. But I can't stage because every time I save, all the changes are gone. – M3VRIX Feb 14 '23 at 20:29
  • when you stage changes, they should no longer be in the changes group. They would belong in the staged changes group. – topsail Feb 14 '23 at 21:05
  • I know that too. As I mentioned in my question usually it does goes to the staged section but now as I press ctrl + s or save anyhow it's just disappears from changes, from staged changes from everywhere. Like it was automatically committed or idk. – M3VRIX Feb 14 '23 at 23:00
  • *"Like it was automatically committed or idk"* ... this would be easy to verify. Was it automatically committed? What do you find in your git log? If not committed, not staged, and not in unstaged edits ... I'm not even sure what to say. What are you even doing next? – topsail Feb 14 '23 at 23:21
  • There's nothing in my git history. BUT now as I opened up VS and loaded my project, there are stuff in Staged Changes. o.O (the ones I've been trying to stage before) Is it possible that it was some kind of bug? I just tried and was able to commit successfully. I honestly have no idea what is or what was going on! But looks like some time off was helping it. Or the reload. – M3VRIX Feb 15 '23 at 00:18
  • Yes, I know what that is like. One of life's mysteries. – topsail Feb 15 '23 at 02:39
  • One way to simulate this is to change a file and then change it back to how it was (without using Ctrl-Z). VS will still show the file as pending with an asterisk meaning you have to save it, but after you save it there are actually no changes so it disappears from the list. If you are modifying a file and then save it, it should show up in in the Changes list without the asterisk. (And then you'll also be able to see it as modified from the Git command line.) Until you save the file, VS is just "guessing" that the file is modified and displaying it in the Changes window. Try saving first. – TTT Feb 15 '23 at 03:24

1 Answers1

0

Close VS and in your repository, go to .git folder and delete index.lock file.