LinuxCommandLibrary

fossil-commit

Record changes to the Fossil repository

TLDR

Create a new version containing all the changes in the current checkout; user will be prompted for a comment

$ fossil [[ci|commit]]
copy

Create a new version containing all the changes in the current checkout, using the specified [m]essage
$ fossil [[ci|commit]] [[-m|--comment]] "[comment]"
copy

Create a new version containing all the changes in the current checkout with a comment read from a specific file
$ fossil [[ci|commit]] [[-M|--message-file]] [path/to/commit_message_file]
copy

Create a new version containing changes from the specified files; user will be prompted for a comment
$ fossil [[ci|commit]] [path/to/file1 path/to/file2 ...]
copy

SYNOPSIS

fossil commit [options]

PARAMETERS

-m MESSAGE
    Specifies the commit message directly on the command line. This is the most common way to provide the required check-in description.

-F FILENAME
    Reads the commit message from the specified FILENAME. Useful for longer messages or when scripting commits.

--branch NAME
    Creates a new branch named NAME at the point of this check-in. If the branch already exists, it is reused.

--tag NAME
    Applies a tag named NAME to the newly created check-in. This allows for marking significant points in the repository history, such as releases.

--no-case-check
    Disables the check for case-insensitivity conflicts in filenames. Use with caution, as it can lead to issues on case-sensitive file systems.

--squash
    Attempts to combine the current commit with the previous one. This modifies the history and should be used carefully.

--allow-same-content
    Permits committing a file even if its content is identical to its previous version in the repository. By default, Fossil optimizes by not committing identical content.

--add
    Automatically adds any new, untracked files in the working directory to the commit. This is equivalent to running fossil add for all new files before committing.

--rm
    Automatically removes any missing files from the commit that are present in the repository. This is equivalent to running fossil rm for all missing files before committing.

--verbatim
    Prevents Fossil from normalizing the commit message (e.g., removing leading/trailing whitespace). The message is stored exactly as provided.

DESCRIPTION

The fossil-commit command is a fundamental operation within the Fossil SCM system, analogous to 'commit' in other version control systems like Git or Mercurial. It is used to permanently record changes from the local working directory into the Fossil repository. This includes modifications to existing files, the addition of new files (previously added using fossil-add), and the deletion of files (previously marked for removal using fossil-rm).

When executed, fossil-commit creates a new immutable 'check-in' (also known as a 'changeset') that encapsulates all the staged changes. Each check-in is uniquely identified and includes metadata such as the author, timestamp, and a mandatory commit message describing the changes. This command is an atomic operation, meaning all changes are recorded as a single unit, ensuring data integrity and consistency within the repository's history.

CAVEATS

A commit message is mandatory; if not provided via -m or -F, Fossil will typically open an editor for input.
By default, fossil-commit only records changes to files that have been explicitly added (fossil-add) or marked for removal (fossil-rm). Untracked or modified but unstaged files will not be included unless --add or --rm options are used.
Committing changes does not automatically push them to a remote repository; a subsequent fossil-push command is required for synchronization.

TYPICAL WORKFLOW

A common workflow involves:
1. Modifying existing files or creating new ones.
2. Using fossil add to stage new files or fossil rm to mark files for deletion.
3. Reviewing changes with fossil status or fossil diff.
4. Finally, executing fossil commit to record all staged changes into the repository.

CHECK-IN VS. COMMIT

In Fossil's terminology, the result of a successful fossil-commit operation is often referred to as a 'check-in' or 'changeset'. These terms are largely synonymous with 'commit' in other VCS systems, representing a distinct, immutable snapshot of the repository at a specific point in time.

HISTORY

The fossil-commit command is a core component of the Fossil SCM system, which was created by D. Richard Hipp, the author of SQLite, and first released in 2008. From its inception, Fossil was designed as a self-contained, lightweight, and single-executable distributed version control system. The 'commit' operation has been central to its workflow, reflecting the established practices of version control while integrating Fossil's unique features like built-in ticketing, wiki, and web interface. Its implementation emphasizes atomicity and immutability for repository history.

SEE ALSO

fossil(1), fossil-add(1), fossil-rm(1), fossil-status(1), fossil-push(1), fossil-diff(1)

Copied to clipboard