I leave Emacs running all day, and will often will do a lot of file system manipulation on files that are open in Emacs buffers. For example, I might switch to a different branch in Git that has a very different directory structure.
Unfortunately this leaves me with a bunch of open buffers that Emacs now registers as "modified" buffers referring to "new" files. Unless I'm careful to manually close them each time I do this, it's easy to reflexively save those buffers which then results in spurious, probably duplicate files in my project. I can't even close emacs without answering the "save this buffer" question for each one.
Is there a way to automatically close unmodified buffers when the underlying file disappears? Similar in spirit to a
global-auto-revert-mode that also handles when a file is removed entirely?