LinuxCommandLibrary

fossil-delete

Remove a file from the fossil repository

TLDR

Remove a file or directory from Fossil version control

$ fossil [[rm|delete]] [path/to/file_or_directory]
copy

Remove a file or directory from Fossil version control, and also delete it from the disk
$ fossil [[rm|delete]] --hard [path/to/file_or_directory]
copy

Re-add all previously removed and uncommitted files to Fossil version control
$ fossil [[rm|delete]] --reset
copy

SYNOPSIS

fossil delete OPTIONS FILENAME ...

PARAMETERS

-n, --dry-run
    If given, display instead of run actions

--chdir DIR
    Change to DIR before executing

--clean
    Skip the delete confirmation dialog

--dir
    List files in a directory tree format

--force
    Skip the delete confirmation dialog

--hard
    Delete from disk too, not just from repo

--ignore
    Skip files that do not exist in checkout

--no-prompt
    Skip the delete confirmation dialog

-q, --quiet
    Reduce output clutter

DESCRIPTION

The fossil delete command (alias for fossil rm) removes specified files from the current Fossil repository checkout and stages those deletions for inclusion in the next commit.

It updates the checkout manifest to reflect the deletions but does not alter the repository history itself—deletions are only committed when you run fossil commit. By default, it prompts for confirmation before deleting to prevent accidental removals.

Key behaviors:
• Marks files as deleted in the checkout.
• Optionally deletes files from the local filesystem with --hard.
• Shows a directory tree of affected files with --dir.
• Supports dry-run mode with -n to preview changes without applying them.

This command is essential for cleaning up obsolete files in a Fossil project, ensuring the repository reflects the current project state. It works on the local checkout only and requires a clean working directory for commits afterward.

CAVEATS

Deletions are staged but not permanent until committed with fossil commit. Use --hard cautiously as it removes files from disk irreversibly. Requires write access to the checkout.

EXAMPLE

fossil delete --hard *.tmp
Deletes all .tmp files from disk and stages removal.

REVERT

Use fossil update or fossil revert before committing to undo staged deletions.

HISTORY

Introduced in early Fossil versions (circa 2007) by D. Richard Hipp as part of core SCM operations. Evolved with options like --hard in later releases for better UX; delete remains an alias for rm for familiarity.

SEE ALSO

fossil-add(1), fossil-rm(1), fossil-commit(1), fossil-update(1)

Copied to clipboard