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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With