LinuxCommandLibrary

fossil-add

Add files or directories to repository

TLDR

Put a file or directory under version control, so it will be in the current checkout

$ fossil add [path/to/file_or_directory]
copy

Remove all added files from the current checkout
$ fossil add --reset
copy

SYNOPSIS

fossil add [OPTIONS] FILE...

PARAMETERS

-R , --repository
    Specifies the Fossil repository database file to operate on.

-f, --force
    Forces the addition of files, even if they are currently ignored or if there are conflicts.

-r, --recursive
    Adds files within specified directories recursively. This is often the default behavior when adding a directory, but ensures all subdirectories are processed.

-v, --verbose
    Prints additional details about the files being added.

--dry-run
    Performs a trial run without actually adding files, showing what would be added.

--glob
    Treats FILE arguments as glob patterns rather than literal filenames.

--case-sensitive
    When used with --glob, treats patterns as case-sensitive.

--no-case-sensitive
    When used with --glob, treats patterns as case-insensitive (default on Windows/macOS).

--once
    Only adds a file if it is not already tracked by Fossil.

--
    Marks the end of command-line options, allowing subsequent arguments to be treated as filenames even if they start with a hyphen.

FILE...
    One or more paths to files or directories to add to the repository.

DESCRIPTION

fossil add is a command used in the Fossil SCM (Source Code Management) system to mark new files or directories for inclusion in the repository. It scans the provided paths, determines which files are not yet tracked, and stages them for the next commit. This command is analogous to git add in Git.

When adding directories, fossil add can operate recursively to include all new files within that directory and its subdirectories. It ensures that only actual file content is tracked, meaning empty directories are not added to the repository directly. Files can be specified individually, via wildcards, or by pointing to a directory. After using fossil add, the changes must be finalized with a fossil commit command.

CAVEATS

fossil add only stages files for addition; a subsequent fossil commit is required to finalize the changes in the repository.
By default, files matching patterns in ignore-glob settings (e.g., in .fossil-settings/ignore-glob) are not added unless the --force option is used.
Fossil does not track empty directories. If a directory contains no files, it will not be added to the repository.

ADDING DIRECTORIES

When a directory is specified as an argument to fossil add, the command will recursively scan the directory and all its subdirectories for new files. These files will be staged for inclusion in the repository. Empty directories are not tracked.

INTERACTION WITH IGNORE SETTINGS

fossil add respects the global and local ignore settings (e.g., defined via fossil setting ignore-glob or .fossil-settings/ignore-glob files). Files matching these patterns will typically be skipped during the add process. To override this behavior and force the addition of an ignored file, the --force option must be used.

HISTORY

The fossil-add command is an integral part of the Fossil SCM system, which was created by D. Richard Hipp, the developer behind SQLite. Fossil was designed as a simple, distributed version control system that integrates project management (bug tracking, wiki, forum) within a single self-contained executable. The add command has been a fundamental component since Fossil's early development, reflecting its role as a core operation for bringing new content under version control, much like its counterparts in other SCMs like Git or Subversion.

SEE ALSO

fossil commit(1), fossil status(1), fossil rm(1), fossil extra(1)

Copied to clipboard