Problems when switching git branches


#1

I’m having issues when switching branches in Atom.

When I switch to a branch from master, edit a file in that branch, and return to the master branch, the file contents remain the same in the atom editor window. If I try to close the file, it warns me of unsaved changes. It will not let me save the file, and I wouldn’t want to anyway, so I discard the changes and close the editor pane. If I try to open the file up again, it cannot open it. The file has been deleted. If I try to do a git reset --hard, it tells me it cannot create the file as it does not have the correct permissions.

The only workaround I have found is to close atom and reopen it. Then I can do the git reset --hard.

I have permissions on this folder. I’ve tried running Atom as an admin and as a regular user. I’ve tried in multiple repositories. I have the latest 64-bit version of git (2.17.0 as of this writing) on Windows 10. This problem doesn’t happen in Visual Studio code, so this certainly seems like an atom problem. It feels like it’s not closing the file handle or something and it won’t until atom is closed entirely.

Does anyone have a solution to this problem?

Thanks.


#2

Hi :wave:

Do you have a %USERPROFILE%\.atom\recovery folder? Can you try creating one if it doesn’t exist?

There is an issue where this folder did not get created automatically which caused issues similar to what you describe. It has been fixed on master but I don’t think there has been a released version including the fix yet.


#3

I did not, but adding it seems to have fixed the problem.

Thanks.