Previous version of file

Viewed 25

Sometimes, I find that when I save a file with vim, the version of the file reverts to a previous version I had edited maybe earlier in the day or some time before the last time I saved it. The familiarity forces me to redo the work because of the file reverting to the previous version. The folder is a Github repository. Any thoughts on how I can prevent this from happening?

1 Answers

Are you sure you are doing :wq?

In VI/VIM, you need the w option to write the file before closing it.

Related