LinuxCommandLibrary

fossil-forget

Remove historical artifacts from Fossil repository

TLDR

View documentation for the original command

$ tldr fossil rm
copy

SYNOPSIS

fossil forget [OPTIONS] FILE...

PARAMETERS

--dry-run | -n
    Perform a trial run without making any actual changes. This option displays what files would be forgotten, but does not modify the manifest or the filesystem.

--hard | -H
    In addition to forgetting the files from the repository's manifest, this option also removes the specified files from the local working directory on disk. This effectively makes fossil forget --hard behave identically to fossil rm.

DESCRIPTION

The fossil-forget command is an essential tool within the Fossil SCM (Source Code Management) system, designed to cease tracking one or more files in the repository's manifest without removing them from your local working directory. It marks specified files for removal from the project's version control oversight. This operation is staged and only becomes permanent in the repository's history after a subsequent fossil commit command. This command is particularly useful for rectifying accidental additions of files, or for gracefully untracking files that are no longer considered part of the project's source code but should remain accessible in the local workspace (e.g., temporary build artifacts, local configuration files, or user-specific settings). By default, fossil-forget ensures the physical file remains untouched on your disk, providing flexibility to manage it independently or to add its pattern to the .fossil-settings/ignore-glob file for future automatic exclusion from tracking.

CAVEATS

Using fossil forget only stages the untracking action; a subsequent fossil commit is required to make the change permanent in the repository's history.
By default, fossil forget does NOT delete files from your local disk. If you wish to remove them from disk as well, use the --hard option.
Once a file is forgotten and committed, it will no longer be tracked in new check-ins from that point forward, though its history prior to the forget operation remains accessible.

STAGING OPERATION

The fossil forget command operates as a staging operation. It prepares the list of files to be untracked for the next commit. The change is not permanent in the repository until you explicitly run fossil commit. Until then, you can revert the 'forget' action by simply re-adding the file using fossil add, or by reverting your changes.

IGNORING VS. FORGETTING

It's important to distinguish between 'forgetting' a file and 'ignoring' one. fossil forget removes a file that was previously tracked. To prevent new or existing untracked files from ever being added to version control, you should define patterns in the .fossil-settings/ignore-glob file (or similar global ignore configurations). This helps maintain a clean working directory status and prevents accidental additions of transient files.

HISTORY

Fossil SCM, developed by D. Richard Hipp (the creator of SQLite), emerged as a single, self-contained executable integrating version control, bug tracking, wiki, and forum functionalities. Its design emphasizes simplicity, reliability, and ease of deployment. The inclusion of the forget command, distinct from a direct file deletion, reflects a deliberate design principle common in modern SCMs (like Git's rm --cached). This separation allows developers fine-grained control over their working directory, enabling them to untrack files from the version control system without necessarily losing their local copies. This flexibility is key to managing project artifacts efficiently, especially in scenarios where certain files are generated or used locally but should not be part of the shared repository history.

SEE ALSO

fossil add(1), fossil rm(1), fossil commit(1), fossil status(1), git-rm(1)

Copied to clipboard