Search code examples
githubgithub-pagesredundancy

Reduntant files in GitHub


I was performing commits with minor changes in my code and did a lot of them. At the end when I see my github account couple of files are redundant with same name but with a tilde character at the end.

Example : There are 2 files index.html and index.html~

If I pull the latest version to my local repository to remove them, I don't see the files with (~) at the end. I however did some edits directly on the github web portal. Is it because of that?

I didn't create multiple branches as well, but was working on the master branch.

I would like to know why there are redundant files and how to get rid of them from my github.


Solution

  • You probably did

    git add .
    

    You may not have '.gitignore' file too.

    The ~ files are created by your text editor when you are editing your file.

    Just create a .gitignore file and add this to the file

    ~
    

    Then commit the gitignore file too. In the future, avoid using

    git add .