Reputation: 8851
I am building a site with code igniter and I am using git for version control. I am not sure why, but duplicates of my files keep popping up. If I have a home.php controller there is also a home.php~ controller. It is not really causing a problem with the functionality of the site, but it is weird and I don't like it. What exactly is going on?
My editor was set to backup files. I just had to turn it off.
Upvotes: 2
Views: 1158
Reputation: 17719
As ~ files are backup files, I have found backups useful when there has been an issue saving or the editor closes unexpectedly.
I prefer to have the backup files, but add these files to the .gitignore file to prevent them being added to source control:
Add this line to the .gitignore file to ignore files ending with a tilde ~:
*~
Upvotes: 1
Reputation: 57656
The tilde files are automatic backup files of the last version created by the text editors. You can turn off this automatic creation by editing the preferences of the text editor you use.
Upvotes: 4
Reputation: 22261
Conventially, the ~ suffix indicates a backup copy. It is usually created by an editor which saves a backup copy of the file (with the old contents) when you make changes to it. You area probably using an editor that does this.
I believe the convention to use ~ as a suffix for backup files started with a long time ago with emacs.
Upvotes: 2
Reputation: 754763
It sounds like you've been editting with vim and don't have the backup
option disabled. By default vim will backup file edits with a file of the same name suffixed with ~
. Try adding the following to your .vimrc
set nobackup
Upvotes: 1
Reputation: 81694
Emacs uses that convention to name the backup files it creates; have you been using Emacs? It's an old convention, so it's possible there are other things that use that format too.
Upvotes: 1
Reputation: 301147
Those are probably temporary / backup files created by an editor like emacs, vim etc. Anyway, such files would have nothing to do with git.
Upvotes: 2