Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring Hidden Files git

Tags:

git

I added files ending with ~ in my repository in GitHub and now I want to remove them.

For example I added:

README.md

and the file

README.md~ 

was added as well.

Any help please?

like image 440
glarkou Avatar asked Jun 23 '11 11:06

glarkou


1 Answers

For ignoring all the file ending with a ~ you should add this to the .gitignore file at the top-level in your repository (alongside the .git directory).

# Ignore all emacs backup files
*~

Then, for changing the history and removing the README.md~ file, you can either do it manually with git rebase --interactive or try to use git filter-branch:

$ git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch README.md~' HEAD
like image 84
Sylvain Defresne Avatar answered Oct 01 '22 01:10

Sylvain Defresne