返回资讯中心
外部精选
软件工程
#开发者实时流

101 Reasons Why Fossil Is Better Than Git

Fossil remembers where all your repositories and working

Hacker News 最新DASD2026/11/1 · 16 天前30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Fossil remembers where all your repositories and working checkouts are located. This and other information (such as all your global settings) is stored in a per-user database file at $HOME/.config/fossil.db on unix or in %LOCALAPPDATA%/_fossil on Windows. Fossil creates and manages that file automatically. The user never has to know the file even exists. If you move or rename repositories or checkouts, the database will get temporarily out of sync with reality, but Fossil will automatically fix the database the next time you do anything with the file or checkout that was moved or renamed. You can get a list of repositories using the "fossil all ls" command, or a list of open checkouts using "fossil all ls --ckout".

Fossil lets you bring up a web-based UI that shows all of your repositories at once. Run the command "fossil ui /" and your default web browser will pop up a new tab that lists all of your repositories together with the associated project name and how recently that repository was modified. Click on links to bring up repository-specific web-pages. Or click on column headers to sort by that column. If you are like me and have hundreds of repositories on your desktop system, this feature makes it easier to keep track of them all, or just to remember what you called each one. Are you on an infrequently used travel laptop and forgot where you put a particular repository, this feature helps you find it.

Fossil lets you quickly find uncommitted changes across all of your open checkouts. Simply run "fossil all changes" to get a quick summary of every checkout on your local machine that needs a commit.

Fossil lets you sync all of the changes in all of your local repositories to their remotes, with a single command. Run "fossil all sync" and all your local repositories will sync up. This is useful, for example when taking a laptop off-network. Before disconnecting, you sync all of your repositories. Fossil itself keeps track of all of your repositories, so you cannot accidentally forget one or two. While off-network, you might commit changes to one or more of those repositories. Once you reconnect, you simply run "fossil all sync" again to push out your edits back to the community.

Fossil allows multiple check-ins to have the same tag. For example, on the SQLite project, every release is tagged with "release".

The Fossil timeline can show all check-ins with a specific tag. For example, to see all SQLite releases visit https://sqlite.org/src/timeline?t=release or to see all Fossil releases go to https://fossil-scm.org/home/timeline?t=release.

Fossil has a built-in wiki. Wiki pages are stored in the same repository file as your code, so that they push, pull, sync, and clone together with your code.

Git does not itself have a wiki. The various Git forges usually add wikis, and store the wiki content in Git, though in a separate Git repository. There is no option to store the wiki and source code together such that they clone and sync as one, in the Git ecosystem.

Fossil can associate a wiki page with a particular check-in. Rather than including an oversized check-in comment on an important check-in (such as the merge of a big new feature), Fossil allows you to assign a wiki page to that check-in. That wiki page is shown as part of the check-in information in the web interface. See, for example, the "About" section of SQLite check-in 2019-11-21T18:28:44.463Z. The wiki page associated with a check-in can be created and revised after the check-in is committed and pushed. This feature can be used to add notes or bug reports that occur long after the check-in itself has been inserted into the DAG.

Fossil can associate a wiki page with a particular branch. You can create a wiki page for a branch that documents the purpose of that branch. The wiki page can be displayed separately (like any other wiki page) but is also displayed automatically at the top of every timeline for that branch. See, for example, https://sqlite.org/src/timeline?r=autosetup.

Fossil keeps track of historical branch names. Git does not track branches. Git only names each leaf of the DAG and infers branches based on the names of leaves. Fossil actually remembers the name of branches. For example, suppose a customer asks "Whatever became of that setlk-snapshot-fix branch you started last year?" That branch still exists and you can see it on GitHub and in Fossil. Notice, though, that GitHub does not show how the branch was resolved. (Aside: Also notice how much faster Fossil renders!) Fossil clearly shows that the branch ended up being merged into trunk. GitHub just shows us all ancestors of the leaf node labeled "setlk-snapshot-fix", including ancestors that were in other branches that got merged in, and ancestors that predate the founding of the setlk-snapshot-fix branch.

GitHub is unable to show you the check-ins of branch setlk-snapshot-fix only. There are other third-party tools that will show you that, I am told, but they all require a local clone of the repository. Apparently there is no way to see this information in a web browser using Git, with or without third-party tools.

Fossil has a built-in bug tracking system.. Tickets are stored in the repository together with source code and push/pull/sync the same as the code. The ticket system is configurable and distributed. Repository administrators can determine what fields appear in tickets and what users are allowed to create, edit, or moderate tickets.

Fossil allows multiple branches with the same name. As an example, the SQLite project has multiple branches named "experimental" https://sqlite.org/src/timeline?r=experimental and many others named "mistake" https://sqlite.org/src/timeline?r=mistake. Another example: the empty-table-optimizations branch(es) which was initially merged to trunk and closed on 2025-07-02, but then reopened and continued with more enhancements until it was merged again on 2025-07-08.

Fossil allows both legacy SHA1 hashes and newer SHA3-256 hashes in the same repository. Both Fossil and Git started out using only SHA1 hashes. But when the SHAttered attack against SHA1 was published on 2017-02-23, the need to migrate to a stronger hash algorithm was recognized. Fossil added the ability to use SHA3-256 as an alternative on 2017-03-01 (six days after the SHAttered attack was first published). SHA3-256 is now the default for all new repositories and check-ins in Fossil, though older check-ins that occurred prior to SHAttered can still use their original SHA1 hash. Hence, no repositories had to be rebuilt and no hyperlinks were broken. In contrast, after nine years, a Git repository can still only support one hash algorithm at a time. Newer Git repositories are able to use SHA2, though the default is still SHA1.

Fossil allows check-ins to be identified by timestamp The canonical name for a check-in is its hash. Both Git and Fossil allow a check-in to be identified by any unique prefix of its hash. But only Fossil allows a check-in to also be identified by its timestamp. The names "2026-02-02T16:03:24.852Z" and "fdebbedbd9a99165" both refer to the same check-in, but the first one has the advantage of giving some time context rather than just being a seemingly random sequence of hexadecimal digits. It is possible that two or more check-ins can have the same timestamp, in which case the timestamp would be ambiguous. And a check-in timestamp can be changed after it is committed, by using a special tag. So timestamp identifiers do not have the uniqueness and stability guarantees as hash identifiers, but they are available as an option and are often useful.

Fossil has a built-in forum. The forum content is replicated via push, pull, sync, and clone just like source code. Forum posts can be enabled per user or for all users or for all users and anonymous passers-by. Some users can be appointed as moderators and posts from untrusted users can be held for moderation.

The Fossil Forum, the SQLite User Forum, and the SQLite Bugs Forum are all forums set up for specific purposes and deliberately kept separate from source code. But other projects such as Pikchr comingle their forum and the source code in the same repository. Thus when you clone the Pikchr source repository, you also get all the Forum history.

Fossil makes it easy to set up a project website using CGI. If you have an internet-facing machine running a CGI-capable web server, you can stand up a complete self-hosting project website with a two-line CGI script. The canonical Fossil website is really just such a CGI script. When you clone the Fossil source code, you don't just get the code, you get the entire website.

The CGI script used to run the Fossil website looks approximately like this:

#!/usr/bin/fossil repository: /Fossils/fossil.fossil

You can, of course, also create a self-hosting website using GitLab or Forgejo or similar, but the setup and maintenance is somewhat more involved. You'll also probably need a bigger machine if you are using GitLab, whereas a Fossil website works fine on a 2GiB Raspberry PI or a $6/month VPS. I am told that Gitea and Forgejo also work well on a small machine. No direct size and performance comparisons between Gitea/Forgejo and Fossil have been made, as of this writing.

Fossil makes it easy to set up a project website using SCGI. CGI is easier, but some web servers (ex: Nginx) do not support CGI. If you are using such a web server, you can also run a Fossil server using SCGI. See the on-line Fossil SCGI documentation for details.

Fossil makes it easy to set up a project website behind a reverse proxy. Simply run a Fossil HTTP server and have your reverse proxy redirect requests to this new Fossil server. You can also set up the Fossil server to work over named pipes rather than a loopback, if your reverse proxy supports that.

Fossil makes it easy to set up a project website without using any web server at all. The fossil server command includes a --cert option with which you can specify a TLS cert for encrypted communication, and with the option, Fossil will accept ordinary HTTPS requests from the open internet. There is no need to install and configure a separate web server. Hence, the only software you need to stand up a project website using Fossil is the stand-alone "fossil" binary.

A single Fossil server is able to host multiple projects. By default, each Fossil server provides content for a single repository. But you can launch a Fossil server that hosts multiple repositories by putting all those repositories in a directory and giving the directory name as the object to serve instead of the repository name. For this mode of operation, the repositories must be named with the ".fossil" file suffix. Individual projects have URLs that begin with the repository base name, omitting the ".fossil" suffix.

Fossil automatically pushes after each commit, by default. The autosync setting, which defaults to "on", causes every commit to automatically push to the default remote. This helps to keep the remote up-to-date and helps all the developers working on the project keep up with what other developers are doing.

Long-time Git users might cringe at autosync, thinking that this could cause problems if another developer commits ahead of you. True enough, that would cause headaches for Git, but it does not create problems for Fossil. The worst that could happen is that the branch will fork. Fossil will usually detect an impending fork and warn you. But even if you don't get the warning (due to a race) or even if you override the warning and force the commit anyhow, a fork on a branch in Fossil is harmless. It shows cleanly in the timeline and is easily resolved. So while autosync might cause issues with Git, it is harm

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →