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] FILENAME ...

PARAMETERS

--case-sensitive <NAME>
    Treat <NAME> as case sensitive during rename detection

--chdir <DIR>
    Change working directory to <DIR> before running

--clean
    Recursively delete from checkout all files not in repo

--depth <N>
    Limit scan depth to N directory levels

--dirsonly
    Add directories only, skip files

--dotfiles
    Include files beginning with "."

--emptydirs
    Recursively add all empty directories

--ignore-on-commit-glob <GLOB>
    Ignore files matching GLOB on commit

--ignore-vfile-glob <GLOB>
    Ignore files matching GLOB in vfile state

--inside <DIR>
    Limit addition to files inside <DIR>

--keep-file
    Keep files despite ignore patterns

-N, --dry-run
    Show actions without executing

--no-rescan
    Skip rescan of disk files

--quiet
    Reduce output verbosity

-R, --repository <REPO>
    Use specific repository file

--reset
    Reset repo state on error

--show-files
    List files being added

DESCRIPTION

The fossil add command stages one or more files (or directories) for the next commit in a Fossil repository checkout. Similar to git add, it updates the _vfile table to mark files as ADDED, EDITED, DELETED, or MISSING. New files are scanned from the filesystem and added if they match criteria, respecting ignore-glob settings unless overridden.

It supports recursive addition of directories, cleaning missing files with --clean, and dry-runs with -N. Use fossil status to verify staged changes before committing. Fossil ignores files matching global ignore patterns by default, configurable via fossil set. Ideal for software projects with integrated bug tracking and wiki.

Common workflow: checkout repo, edit/add files, fossil add, fossil commit -m "message". Handles symlinks, dotfiles with flags.

CAVEATS

Requires a Fossil checkout directory; ignores files by default per project settings; use --keep-file to override. Not for binary files without care due to diff limits.

EXAMPLES

fossil add *.c
fossil add --clean .
fossil add -N app/

IGNORE PATTERNS

Controlled by ignore-glob setting: fossil set ignore-glob "*.o *.log". View with fossil settings.

HISTORY

Introduced in Fossil 1.0 (2007) by D. Richard Hipp as part of self-contained DVCS. Evolved with options like --clean in 2010s; current in Fossil 2.24 (2024), emphasizing simplicity over Git.

SEE ALSO

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

Copied to clipboard