The often used add command is how you tell fossil to include a (usually new) file in the repository.

fossil is designed to manage artifacts whose role is being "source" for something, most probably software program code or other text. One can imagine all kinds of ways to let fossil know just what constitutes a source; the simplest and most direct way it actually finds out is when you give it the fossil add path command.

It's reasonable to think of the import and clone commands as very high-powered versions of the add command that are combined with system level file movement and networking functions. Not particularly accurate, but reasonable.

Typing  fossil add myfile causes fossil to put myfile into the repository at the next commit—provided you issue it from within the source tree, of course.

By contrast,  fossil add mydirectory will add all of the files in mydirectory, and all of its sub-directories. In other words, adding a directory will recursively add all of the directory's file system descendants to the repository. This was an oft-requested feature, recently implemented. It is very flexible. Only when you add a directory do you get the recursive behavior. If you are globbing a subset of files, you won't get the recursion.

Realize that the repository is not changed by the add command, but by the  commit command. add myfile tells fossil to "mark" myfile as part of the repository. Only commands which actually manipulate the content of the repository can physically put source artifacts into (or remove them from) the repository.

Just to keep things symmetric, there are also commands that can manipulate the repository without affecting the checked-out sources (see fossil pull, for instance.)

It's worthwhile reiterating that fossil is storing the content of source artifacts and the names of the artifacts in their "native habitat", a sequence of "temporal slices" (aka "versions") of the state of the whole system, and a set of unique identifiers. When you add a file to a repository, the path to the file is a part of the name of the file. There is a mis-match between the file system's idea of a directory (a file containing pointers to files) and fossil's idea (a substring of the name of the artifact.) The names of the artifacts specify their relative locations because of the way the file system interprets them. If you don't keep this in mind, you may fool yourself into thinking fossil somehow "stores directories." It doesn't, and believing it does will eventually confuse you.

See also: fossil rm, fossil import, fossil clone, fossil commit, fossil pull, fossil setting (async), Reference