'gitignore trailing /** vs trailing / vs just putting directory

I'm trying to understand if I need to put a trailing /** on my directory list for my gitignore file.

Are

doc-assets
doc-assets/
doc-assets/**

all the same thing? I'm not seeing a difference, but people seem to specify in other answers here that the /** includes all items in a directory... which seems unnecessary if I'm just ignoring the directory itself.

In this case, the directory is at the root of the git repository, and .gitignore is in the root as well.

Is it possible that the specificity (or lack thereof) is so people can specify files NOT to ignore? What other reasons would there be for using one of those three ignore options over another?



Sources

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

Source: Stack Overflow

Solution Source