4

I have a folder containing a repository I am working on. In my repo, I have a file called README.md, as most repos do.

However, randomly, Ubuntu creates a file called README.md~, which gets pushed up to my repository on github in my next push. Then in my public repo I have two README files, which is slightly confusing and strange.

Why is this happening and how do I stop this?

CodyBugstein
  • 145
  • 6
  • 2
    This is fairly normal, but it depends on the editor you're using. What editor are you using to edit the README.md file and are you committing while the editor is still open? – RPiAwesomeness Sep 30 '15 at 16:52
  • 3
    1st hit on google "file ending in ~".... conclusion: you are using gEdit and have the automatic backup active. – Rinzwind Sep 30 '15 at 17:39
  • ^ Actually leafpad does that too, but still pretty accurate. – Wolfer Sep 30 '15 at 17:47
  • 2
    Possible duplicate of [Prevent gedit from creating files with the '~' (tilde) suffix](http://askubuntu.com/questions/83026/prevent-gedit-from-creating-files-with-the-tilde-suffix) – muru Oct 01 '15 at 01:19

1 Answers1

9

The *~ files are backup files of your editor.

Open or create an ignore file .gitignore in the root of your project folder and add the line *~ which means: Ignore all files which filename ends with a ~

echo "*~" >> .gitignore
A.B.
  • 89,123
  • 21
  • 245
  • 323