What does * ~ do in a .gitignore file?

I just ran the gitignore file, which ends with the line * ~, but I could not find a description of what this does.

+5
source share
2 answers

It ignores all files whose name ends with ~ , which is the usual suffix for text editor backup files.

* is a special character and means "any sequence of zero or more characters", and ~ is an ordinary character. The union of two parts: "zero or more characters, followed by the character" ~ ".

+13
source

It tells Git to ignore all files that end with a tilde (~), which is used by many text editors such as Emacs or Vi to mark temporary files.

+3
source

Source: https://habr.com/ru/post/1214122/


All Articles