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

FILENAME...
    One or more paths to files or directories that are to be deleted from the working directory and marked for removal from the Fossil repository.

-R <REPOSITORY> or --repository <REPOSITORY>
    Specifies the path to the Fossil repository database file on which the command should operate. If omitted, Fossil attempts to find a repository in the current directory or parent directories.

-f or --force
    Forces the deletion, even if the target file has uncommitted local modifications. Using this option will discard any unsaved changes to the file before deleting it.

-i or --ignore-missing
    Suppresses error messages if any specified FILENAME does not exist in the working directory or is not currently tracked by Fossil.

-n or --dry-run
    Performs a simulation of the delete operation. It shows which files would be deleted without actually modifying the filesystem or the repository state.

--case-sensitive
    Applies case-sensitive matching when comparing FILENAME arguments, overriding the repository's default or the underlying filesystem's case sensitivity.

--exact
    Disables globbing for FILENAME arguments, treating them as literal file paths rather than patterns.

--glob
    Interprets FILENAME arguments as glob patterns (e.g., *.txt) to match multiple files, which is often the default behavior but can be explicitly enabled.

DESCRIPTION

The fossil delete command is a fundamental utility within the Fossil SCM (Self-Contained Distributed Software Configuration Management) system, designed to manage the removal of files from a project. Its primary function is to remove one or more specified FILENAMEs from both the working directory and to mark them for deletion within the Fossil repository's version control.

Unlike a simple operating system's rm command, fossil delete performs a crucial dual role: it physically removes the file from your local filesystem and, more importantly, it informs Fossil that these files are no longer part of the project's tracked history. This action stages the deletion, meaning the removal is noted by Fossil and will be permanently recorded in the repository only upon the next fossil commit. This staging mechanism provides a safety net, allowing users to review or undo the deletion before it becomes a permanent part of the project's version history.

The command is essential for maintaining a clean and accurate project structure, ensuring that obsolete or unwanted files are properly removed from source control, reflecting the project's current state. It intelligently handles various scenarios, such as preventing deletion of modified files unless explicitly forced, and can be configured to ignore missing files, making it robust for scripting and automated workflows.

CAVEATS

Files are marked for deletion in the repository, but the deletion is only permanent after a fossil commit.
If not committed, the deletion can be easily undone using fossil undo.
Using the -f or --force option will discard any local uncommitted changes to the file, so use with caution.

STAGING DELETIONS

Deleting a file with fossil delete doesn't immediately remove it from the repository's historical record. Instead, it stages the deletion for the next commit. This crucial feature provides a safety net, allowing users to review the planned removal, potentially revert the action, or amend the commit before the file's deletion becomes a permanent part of the current branch's history.

DIFFERENCE FROM 'RM'

The standard Linux rm command only removes files from the filesystem. In contrast, fossil delete performs a dual action: it removes the file from the filesystem and, critically, informs the Fossil SCM system that this file should no longer be tracked. Simply using rm on a tracked file would leave it as a 'missing' file in Fossil's view, requiring further manual intervention to remove it from version control.

HISTORY

Fossil SCM, created by D. Richard Hipp (also known for SQLite), was designed with a focus on simplicity, self-containment, and reliability. The fossil delete command has been an integral part of Fossil's core file management capabilities since its early versions, reflecting Fossil's philosophy of explicit version control actions rather than implicit tracking, ensuring developers have clear control over their project's file lifecycle.

SEE ALSO

fossil add(1), fossil commit(1), fossil rm(1), fossil addremove(1), fossil clean(1)

Copied to clipboard