Fossil

Up and running in 5 minutes as a single user
Login

The following document was contributed by Gilles Ganault on 2013-01-08.


Up and running in 5 minutes as a single user

This short document explains the main basic Fossil commands for a single user, i.e. with no additional users, with no need to synchronize with some remote repository, and no need for branching/forking.

Create a new repository

fossil new c:\test.repo

This will create the new SQLite binary file that holds the repository, i.e. files, tickets, wiki, etc. It can be located anywhere, although it's considered best practice to keep it outside the work directory where you will work on files after they've been checked out of the repository.

Open the repository

cd c:\temp\test.fossil

fossil open c:\test.repo

This will check out the last revision of all the files in the repository, if any, into the current work directory. In addition, it will create a binary file _FOSSIL_ to keep track of changes (on non-Windows systems it is called .fslckout).

Add new files

fossil add .

To tell Fossil to add new files to the repository. The files aren't actually added until you run "commit". When using ".", it tells Fossil to add all the files in the current directory recursively, i.e. including all the files in all the subdirectories.

Note: To tell Fossil to ignore some extensions:

fossil settings ignore-glob "*.o,*.obj,*.exe" --global

Remove files that haven't been committed yet

fossil delete myfile.c

This will simply remove the item from the list of files that were previously added through "fossil add".

Check current status

fossil changes

This shows the list of changes that have been done and will be committed the next time you run "fossil commit". It's a useful command to run before running "fossil commit" just to check that things are OK before proceeding.

Commit changes

To actually apply the pending changes to the repository, e.g. new files marked for addition, checked-out files that have been edited and must be checked-in, etc.

fossil commit -m "Added stuff"

If no file names are provided on the command-line then all changes will be checked in, otherwise just the listed file(s) will be checked in.

Compare two revisions of a file

If you wish to compare the last revision of a file and its checked out version in your work directory:

fossil gdiff myfile.c

If you wish to compare two different revisions of a file in the repository:

fossil finfo myfile: Note the first hash, which is the UUID of the commit when the file was committed

fossil gdiff --from UUID#1 --to UUID#2 myfile.c

Cancel changes and go back to previous revision

fossil revert myfile.c

Fossil does not prompt when reverting a file. It simply reminds the user about the "undo" command, just in case the revert was a mistake.