Search code examples
gitignore

What's the possible usage of ".gitignore~" in a gitignore file?


I can't understand it's usage because tilde is not a metacharacter in Regular expression.

I saw it here:

https://github.com/spring-guides/tut-rest/blob/master/.gitignore

https://github.com/spring-guides/tut-rest/commit/a086df26fd7e6b54b369d4fa0b45522c9bc3a570#diff-a084b794bc0759e7a6b77810e01874f2


Solution

  • Some editors like emacs make backup files that end in a tilde, so this rule would ignore any backups made while editing .gitignore itself