This happened:
TRACE:
self.refresh_plugin() # To give focus to the plugin's widget
File "/Users/manuel/anaconda/envs/sentisis3/lib/python3.6/site-packages/spyder/plugins/explorer.py", line 94, in refresh_plugin
self.treewidget.update_history(new_path)
File "/Users/manuel/anaconda/envs/sentisis3/lib/python3.6/site-packages/spyder/widgets/explorer.py", line 1124, in update_history
directory = osp.abspath(to_text_string(directory))
File "/Users/manuel/anaconda/envs/sentisis3/lib/python3.6/posixpath.py", line 374, in abspath
cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
Thanks for reporting. We'll fix this in a future release.
@ccordoba12 Is this because what was previously the working directory doesn't exist on the other branch, and we just need to check for that?
Yes, I think so.
I can get the same error message without version control using the following steps:
Ok, thanks a lot @jitseniesen!
@dalthviz, please work on this one.
Just to give here more info about the issue, I can't replicate it in Windows since when you try to delete the folder a dialog says it's open by another program.

However using Ubuntu (and probably in other linux distros), deleting permanently the directory (holding shift + supr or using rm -rf) the error shows up.

@dalthviz You can't just do rm -rf in msys2 (Git-bash) or Cygwin?
Good catch @CAM-Gerlach that was something I didn't test. Although testing it, at least with Git-bash,it doesn't let you delete the directory:

Okay, thanks. Must ultimately be limited by the Win32 APIs MSYS2 is calling.