'Git: How to give warning before adding the untracked file with specific extension

When we add the untracked file with a specific extension (say *.txt) then it should give a pop-up with questions like "Have you done sanity check before?" and upon the answer, it will add that file.

I know there is .gitignore but it will ignore the file completely.

git


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source