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) , .