I have a few source files in a Git repo, main.c
and some others. I use Vim to edit these files.
Say I'm editing main.c
. I make a change, tell Vim to write-out, then switch to a terminal (without killing Vim) and commit/push. If I go back to Vim with main.c
and try to write-out again, I receive this warning:
WARNING: The file has been changed since reading it!!!
Do you really want to write to it (y/n)?
How does committing/pushing modify my source files? Why?
It could be a permission issue (git changing the executable bit of the file).
Try again after git config core.filemode false
.
The solution is simple: reopen the file with :e filename
.
Or (if your files are save and have no current modification), run :bufdo e
, which will make Vim reopen every buffer.