How to ignore files ending with ~ in git?

In git-status, I have

sandbox.sh
sandbox.sh~

I would ignore the last file.

How can you ignore files with the extension of some snake ~?

+4
source share
2 answers

Just add *~to yours .gitignore.

This ignores all files ending in ~

+12
source

The pattern of ignoring anything ending in ~is equal *~. These files are probably left as a backup by your text editor, so they are specific to you and not to the project. It’s best to add this *~to your user ignore file, i.e. ~/.config/git/ignore(create it if it does not exist) in recent versions of Git.

.gitignore,

1) . N , N .gitignore.

2) , .

+3

All Articles