Fossil SCM for beginners (I)

Robert Guiscard
2 min readNov 9, 2021

--

Git is probably the most used tool for source code management. But Fossil is also a good choice with many built-in functions. Here is a quick tutorial of using Fossil.

First, install on Ubuntu like this

sudo apt-get install fossil

Run fossil version to show the version.

Unlike git, which store local repository under .git directory in the working directory, fossil store local repository in a SQLite database independently from the working directory.

Therefore, to create new git repository, run git init in working directory. To initiate a fossil repository, run fossil init my_project.fossil. It creates a file called my_project.fossil. It is a SQLite3 database. To work on actual codes, you need to check out the source codes from it. Let’s create a directory for code

> mkdir local_copy
> cd local_copy
> fossil open /path_to/my_project.fossil

A good thing about this approach is that you can have many working directories for different branches, for example, one for trunk and one for new feature. Switching branch is basically switching directory, which is sometimes more convenient.

Similar to git, add or remove deleted file by runing fossil autoremove. After that, you can commit it by fossil commit.

You can also use remote repository, similar to github or bitbucket. Chiselapp offers free hosting of fossil repository. Once you create or identify a remote fossil repository, you can fossil clone it.

So the relationship and command between remote repository, local repository, working directory (or called checkout) likes this:

Remote repository <-- (clone, pull, push, sync) --> Local repositoryLocal repository <-- (open, addremove, commit, update) --> working directory

Fossil also come with a web server so that you can host your own repository. That’s why it is called distributed version control system. But to be honest, self-hosting a reponsitory facing public takes some efferts to keep it secure. So I would suggest to do so only within a small dev team. To start the fossil web server, run fossil ui for localhost or fossil server if localhost doesn’t work for you.

Another reason to run fossil as server is to edit settings. Fossil repository is a SQLite database, which is not so easy to edit, unlike git which uses plain text for most of settings. Having a web interface eases the problem.

--

--