Editors and scripts leave *.bak and *~ files everywhere, and every * drags them along into commands. Bash can leave them out of all globs at once.
GLOBIGNORE holds a colon separated list of patterns. Names that match are dropped from every glob result:
GLOBIGNORE='*.bak:*~'
ls *
grep -l TODO *
Both commands now skip nginx.conf.bak and notes.txt~. The files are still there; typing the name in full still works, only the wildcards stop returning them.
The manual mentions a side effect that is easy to miss: setting GLOBIGNORE to anything also switches on dotglob, so * now matches hidden files like .env too. If you do not want that, add them to the list: GLOBIGNORE='*.bak:*~:.*'.
Clear it with unset GLOBIGNORE, which also turns that hidden-file behaviour off again. Since it changes what every * means, I would not set it in ~/.bashrc; a later rm * that leaves files behind is confusing in its own way. In a script for one task it is neat.
Further reading: Bash manual: Bash Variables (GLOBIGNORE), Bash manual: Filename Expansion