By default, Emacs keeps just one older "backup" of every file you edit. If you edit a file called foo, then the backup file is called foo~. Whenever you save a new version of the file foo, the previous version is saved as foo~, and the previous backup file is discarded.
You may request that Emacs save multiple backup files, thus yielding a version history of your file. If you set the variable version-control
to t
, then Emacs will save multiple older versions, up to a maximum controlled by the variables kept-old-versions
and kept-new-versions
.
(If you're at all serious about keeping history, though, I recommend that you learn to use a dedicated version control tool such as git
.)