Committer's Guide


FreeBSD is a registered trademark of the FreeBSD Foundation.

Coverity is a registered trademark; Coverity Extend, Coverity Prevent and Coverity Prevent SQS are trademarks of Coverity, Inc.

IBM, AIX, OS/2, PowerPC, PS/2, S/390, and ThinkPad are trademarks of International Business Machines Corporation in the United States, other countries, or both.

Intel, Celeron, Centrino, Core, EtherExpress, i386, i486, Itanium, Pentium, and Xeon are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this document, and the FreeBSD Project was aware of the trademark claim, the designations have been followed by the “™” or the “®” symbol.


This document provides information for the FreeBSD committer community. All new committers should read this document before they start, and existing committers are strongly encouraged to review it from time to time.

Almost all FreeBSD developers have commit rights to one or more repositories. However, a few developers do not, and some of the information here applies to them as well. (For instance, some people only have rights to work with the Problem Report database). Please see Issues Specific to Developers Who Are Not Committers for more information.

This document may also be of interest to members of the FreeBSD community who want to learn more about how the project works.

1. Administrative Details

Login Methods

ssh(1), protocol 2 only

Main Shell Host

Reference Machines

ref*, universe* (see also )

SMTP Host (see also SMTP Access Setup).

src/ Git Repository

ssh://[email protected]/src.git (see also [git-getting-started-base-layout]).

doc/ Git Repository

ssh://[email protected]/doc.git (see also [git-getting-started-doc-layout]).

ports/ Git Repository

ssh://[email protected]/ports.git (see also [git-getting-started-ports-layout]).

Internal Mailing Lists

developers (technically called all-developers), doc-developers, doc-committers, ports-developers, ports-committers, src-developers, src-committers. (Each project repository has its own -developers and -committers mailing lists. Archives for these lists can be found in the files /local/mail/repository-name-developers-archive and /local/mail/repository-name-committers-archive on the cluster.)

Core Team monthly reports

/home/core/public/monthly-reports on the cluster.

Ports Management Team monthly reports

/home/portmgr/public/monthly-reports on the cluster.

Noteworthy src/ Git Branches:

stable/n (n-STABLE), main (-CURRENT)

ssh(1) is required to connect to the project hosts. For more information, see SSH Quick-Start Guide.

Useful links:

2. OpenPGP Keys for FreeBSD

2.1. Creating a Key

Existing keys can be used, but should be checked with documentation/tools/ first. In this case, make sure the key has a FreeBSD user ID.

For those who do not yet have an OpenPGP key, or need a new key to meet FreeBSD security requirements, here we show how to generate one.

  1. Install security/gnupg. Enter these lines in ~/.gnupg/gpg.conf to set minimum acceptable defaults:

    keyid-format 0xlong
    personal-digest-preferences SHA512 SHA384 SHA256 SHA224
    default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
    verify-options show-uid-validity
    list-options show-uid-validity
    sig-notation [email protected]=%g
    cert-digest-algo SHA512
  2. Generate a key:

    % gpg --full-gen-key
    gpg (GnuPG) 2.1.8; Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Warning: using insecure memory!
    Please select what kind of key you want:
       (1) RSA and RSA (default)
       (2) DSA and Elgamal
       (3) DSA (sign only)
       (4) RSA (sign only)
    Your selection? 1
    RSA keys may be between 1024 and 4096 bits long.
    What keysize do you want? (2048) 2048 (1)
    Requested keysize is 2048 bits
    Please specify how long the key should be valid.
    	 0 = key does not expire
          <n>  = key expires in n days
          <n>w = key expires in n weeks
          <n>m = key expires in n months
          <n>y = key expires in n years
    Key is valid for? (0) 3y (2)
    Key expires at Wed Nov  4 17:20:20 2015 MST
    Is this correct? (y/N) y
    GnuPG needs to construct a user ID to identify your key.
    Real name: Chucky Daemon (3)
    Email address: [email protected]
    You selected this USER-ID:
    "Chucky Daemon <[email protected]>"
    Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
    You need a Passphrase to protect your secret key.
12048-bit keys with a three-year expiration provide adequate protection at present (2013-12). describes the situation in more detail.
2A three year key lifespan is short enough to obsolete keys weakened by advancing computer power, but long enough to reduce key management problems.
3Use your real name here, preferably matching that shown on government-issued ID to make it easier for others to verify your identity. Text that may help others identify you can be entered in the Comment section.

After the email address is entered, a passphrase is requested. Methods of creating a secure passphrase are contentious. Rather than suggest a single way, here are some links to sites that describe various methods:,,,

Protect the private key and passphrase. If either the private key or passphrase may have been compromised or disclosed, immediately notify [email protected] and revoke the key.

Committing the new key is shown in Steps for New Committers.

3. Kerberos and LDAP web Password for FreeBSD Cluster

The FreeBSD cluster requires a Kerberos password to access certain services. The Kerberos password also serves as the LDAP web password, since LDAP is proxying to Kerberos in the cluster. Some of the services which require this include:

This must be done from a machine outside of the cluster.

Unless the Kerberos-authenticated services of the cluster have been used previously, Client unknown will be shown. This error means that the ssh method shown above must be used first to initialize the Kerberos account.

4. Commit Bit Types

Committer Type


Tree Components


[email protected]



[email protected]

doc/, ports/, src/ documentation


[email protected]


4.1. Policy for Committer Activity in Other Trees

4.1.1. Documentation Implicit (Blanket) Approval

Some types of fixes have "blanket approval" from the Documentation Engineering Team <[email protected]>, allowing any committer to fix those categories of problems on any part of the doc tree. These fixes do not need approval or review from a doc committer if the author doesn’t have a doc commit bit.

Blanket approval applies to these types of fixes:

  • Typos

  • Trivial fixes

    Punctuation, URLs, dates, paths and file names with outdated or incorrect information, and other common mistakes that may confound the readers.

Over the years, some implicit approvals were granted in the doc tree. This list shows the most common cases:

Before any commit, a build test is necessary; see the 'Overview' and 'The FreeBSD Documentation Build Process' sections of the FreeBSD Documentation Project Primer for New Contributors for more details.

5. Git Primer

5.1. Git basics

When one searches for "Git Primer" a number of good ones come up. Daniel Miessler’s A git primer and Willie Willus' Git - Quick Primer are both good overviews. The Git book is also complete, but much longer There is also this website for common traps and pitfalls of Git, in case you need guidance to fix things up. Finally, an introduction targeted at computer scientists has proven helpful to some at explaining the Git world view.

This document will assume that you’ve read through it and will try not to belabor the basics (though it will cover them briefly).

5.2. Git Mini Primer

This primer is less ambitiously scoped than the old Subversion Primer, but should cover the basics.

5.2.1. Scope

If you want to download FreeBSD, compile it from sources, and generally keep up to date that way, this primer is for you. It covers getting the sources, updating the sources, bisecting and touches briefly on how to cope with a few local changes. It covers the basics, and tries to give good pointers to more in-depth treatment for when the reader finds the basics insufficient. Other sections of this guide cover more advanced topics related to contributing to the project.

The goal of this section is to highlight those bits of Git needed to track sources. They assume a basic understanding of Git. There are many primers for Git on the web, but the Git Book provides one of the better treatments.

5.2.2. Getting Started For Developers

This section describes the read-write access for committers to push the commits from developers or contributors. Daily use
  • Clone the repository:

    % git clone -o freebsd --config remote.freebsd.fetch='+refs/notes/*:refs/notes/*'${repo}.git

    Then you should have the official mirrors as your remote:

    % git remote -v
    freebsd${repo}.git (fetch)
    freebsd${repo}.git (push)
  • Configure the FreeBSD committer data:

    The commit hook in checks the "Commit" field matches the committer’s information in The easiest way to get the suggested config is by executing /usr/local/bin/ script on freefall:

    % git config (your name in gecos)
    % git config (your login)
  • Set the push URL:

    % git remote set-url --push freebsd [email protected]:${repo}.git

    Then you should have separated fetch and push URLs as the most efficient setup:

    % git remote -v
    freebsd${repo}.git (fetch)
    freebsd  [email protected]:${repo}.git (push)

    Again, note that will be canonicalized to in the future.

  • Install commit message template hook:

    % fetch -o .git/hooks
    % chmod 755 .git/hooks/prepare-commit-msg "admin" branch

The access and mentors files are stored in an orphan branch, internal/admin, in each repository.

Following example is how to check out the internal/admin branch to a local branch named admin:

% git config --add remote.freebsd.fetch '+refs/internal/*:refs/internal/*'
% git fetch
% git checkout -b admin internal/admin

Alternatively, you can add a worktree for the admin branch:

git worktree add -b admin ../${repo}-admin internal/admin

For browsing internal/admin branch on web:${repo}/log/?h=internal/admin

For pushing, either specify the full refspec:

git push freebsd HEAD:refs/internal/admin

Or set push.default to freebsd which will make git push to push the current branch back to its upstream by default, which is more suitable for our workflow:

git config push.default freebsd

5.2.3. Keeping Current With The FreeBSD src Tree

First step: cloning a tree. This downloads the entire tree. There are two ways to download. Most people will want to do a deep clone of the repository. However, there are times when you may wish to do a shallow clone. Branch names

The branch names in the new Git repository are similar to the old names. For the stable branches, they are stable/X where X is the major release (like 11 or 12). The main branch in the new repository is 'main'. The main branch in the old GitHub mirror was 'master', but is now 'main'. Both reflect the defaults of Git at the time they were created. The 'main' branch is the default branch if you omit the '-b branch' or '--branch branch' options below. Repositories

Please see the Administrative Details for the latest information on where to get FreeBSD sources. $URL below can be obtained from that page.

Note: The project doesn’t use submodules as they are a poor fit for our workflows and development model. How we track changes in third-party applications is discussed elsewhere and generally of little concern to the casual user. Deep Clone

A deep clone pulls in the entire tree, as well as all the history and branches. It is the easiest to do. It also allows you to use Git’s worktree feature to have all your active branches checked out into separate directories but with only one copy of the repository.

% git clone -o freebsd $URL -b branch [dir]

is how you make a deep clone. 'branch' should be one of the branches listed in the previous section. It is optional if it is the main branch. 'dir' is an optional directory to place it in (the default will be the name of the repo you are cloning (src, doc, etc)).

You will want a deep clone if you are interested in the history, plan on making local changes, or plan on working on more than one branch. It is the easiest to keep up to date as well. If you are interested in the history, but are working with only one branch and are short on space, you can also use --single-branch to only download the one branch (though some merge commits will not reference the merged-from branch which may be important for some users who are interested in detailed versions of history). Shallow Clone

A shallow clone copies just the most current code, but none or little of the history. This can be useful when you need to build a specific revision of FreeBSD, or when you are just starting out and plan to track the tree more fully. You can also use it to limit history to only so many revisions. However, see below for a significant limitation of this approach.

% git clone -o freebsd -b branch --depth 1 $URL [dir]

This clones the repository, but only has the most recent version in the repository. The rest of the history is not downloaded. Should you change your mind later, you can do 'git fetch --unshallow' to get the old history.

When you make a shallow clone, you will lose the commit count in your uname output. This can make it more difficult to determine if your system needs to be updated when a security advisory is issued. Building

Once you’ve downloaded, building is done as described in the handbook, e.g.:

% cd src
% make buildworld
% make buildkernel
% make installkernel
% make installworld

so that won’t be covered in depth here.

If you want to build a custom kernel, the kernel config section of the FreeBSD Handbook recommends creating a file MYKERNEL under sys/${ARCH}/conf with your changes against GENERIC. To have MYKERNEL disregarded by Git, it can be added to .git/info/exclude. Updating

To update both types of trees uses the same commands. This pulls in all the revisions since your last update.

% git pull --ff-only

will update the tree. In Git, a 'fast forward' merge is one that only needs to set a new branch pointer and doesn’t need to re-create the commits. By always doing a 'fast forward' merge/pull, you’ll ensure that you have an exact copy of the FreeBSD tree. This will be important if you want to maintain local patches.

See below for how to manage local changes. The simplest is to use --autostash on the 'git pull' command, but more sophisticated options are available.

5.2.4. Selecting a Specific Version

In Git, the 'git checkout' checks out both branches and specific versions. Git’s versions are the long hashes rather than a sequential number.

When you checkout a specific version, just specify the hash you want on the command line (the git log command can help you decide which hash you might want):

% git checkout 08b8197a74

and you have that checked out. You will be greeted with a message similar to the following:

Note: checking out '08b8197a742a96964d2924391bf9fdfeb788865d'.

You are in a 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 08b8197a742a hook gpiokeys.4 to the build

where the last line is generated from the hash you are checking out and the first line of the commit message from that revision. The hash can be abbreviated to the shortest unique length. Git itself is inconsistent about how many digits it displays.

5.2.5. Bisecting

Sometimes, things go wrong. The last version worked, but the one you just updated to does not. A developer may ask you to bisect the problem to track down which commit caused the regression.

Git makes bisecting changes easy with a powerful 'git bisect' command. Here’s a brief outline of how to use it. For more information, you can view or for more details. The man git-bisect page is good at describing what can go wrong, what to do when versions won’t build, when you want to use terms other than 'good' and 'bad', etc, none of which will be covered here.

git bisect start --first-parent will start the bisection process. Next, you need to tell a range to go through. 'git bisect good XXXXXX' will tell it the working version and 'git bisect bad XXXXX' will tell it the bad version. The bad version will almost always be HEAD (a special tag for what you have checked out). The good version will be the last one you checked out. The --first-parent argument is necessary so that subsequent git bisect commands do not try to check out a vendor branch which lacks the full FreeBSD source tree.

If you want to know the last version you checked out, you should use 'git reflog':

5ef0bd68b515 (HEAD -> main, freebsd/main, freebsd/HEAD) [email protected]{0}: pull --ff-only: Fast-forward
a8163e165c5b (upstream/main) [email protected]{1}: checkout: moving from b6fb97efb682994f59b21fe4efb3fcfc0e5b9eeb to main

shows me moving the working tree to the main branch (a816…​) and then updating from upstream (to 5ef0…​). In this case, bad would be HEAD (or 5rf0bd68) and good would be a8163e165. As you can see from the output, [email protected]{1} also often works, but isn’t foolproof if you have done other things to your Git tree after updating, but before you discover the need to bisect.

Set the 'good' version first, then set the bad (though the order doesn’t matter). When you set the bad version, it will give you some statistics on the process:

% git bisect start --first-parent
% git bisect good a8163e165c5b
% git bisect bad HEAD
Bisecting: 1722 revisions left to test after this (roughly 11 steps)
[c427b3158fd8225f6afc09e7e6f62326f9e4de7e] Fixup r361997 by balancing parens.  Duh.

You would then build/install that version. If it’s good you’d type 'git bisect good' otherwise 'git bisect bad'. If the version doesn’t compile, type 'git bisect skip'. You will get a similar message to the above after each step. When you are done, report the bad version to the developer (or fix the bug yourself and send a patch). 'git bisect reset' will end the process and return you back to where you started (usually tip of main). Again, the git-bisect manual (linked above) is a good resource for when things go wrong or for unusual cases.

5.2.6. Signing the commits, tags, and pushes, with GnuPG

Git knows how to sign commits, tags, and pushes. When you sign a Git commit or a tag, you can prove that the code you submitted came from you and wasn’t altered while you were transferring it. You also can prove that you submitted the code and not someone else.

A more in-depth documentation on signing commits and tags can be found in the Git Tools - Signing Your Work chapter of the Git’s book.

The rationale behind signing pushes can be found in the commit that introduced the feature.

The best way is to simply tell Git you always want to sign commits, tags, and pushes. You can do this by setting a few configuration variables:

% git config --add user.signingKey LONG-KEY-ID
% git config --add commit.gpgSign true
% git config --add tag.gpgSign true
% git config --add push.gpgSign if-asked

To avoid possible collisions, make sure you give a long key id to Git. You can get the long id with: gpg --list-secret-keys --keyid-format LONG.

To use specific subkeys, and not have GnuPG to resolve the subkey to a primary key, attach ! to the key. For example, to encrypt for the subkey DEADBEEF, use DEADBEEF!. Verifying signatures

Commit signatures can be verified by running either git verify-commit <commit hash>, or git log --show-signature.

Tag signatures can be verified with git verity-tag <tag name>, or git tag -v <tag name>.

5.2.7. Ports Considerations

The ports tree operates the same way. The branch names are different and the repositories are in different locations.

The cgit repository web interface for use with web browsers is at . The production Git repository is at and at ssh://[email protected]/ports.git (or [email protected]:ports.git).

There is also a mirror on GitHub, see External mirrors for an overview. The 'current' branch is 'main' . The quarterly branches are named 'yyyyQn' for year 'yyyy' and quarter 'n'. Commit message formats

A hook is available in the ports repository to help you write up your commit messages in git config --add core.hooksPath .hooks.

The first line is the subject of the commit, it contains what port was changed, and a summary of the commit. It should contain 50 characters or less.

A blank line should separate it from the rest of the commit message.

The rest of the commit message should be wrapped at the 72 characters boundary.

Another blank line should be added if there are any metadata fields, so that they are easily distinguishable from the commit message.

5.2.8. Managing Local Changes Keeping a local branch

It is much easier to keep a local branch with Git than Subversion. In Subversion you need to merge the commit, and resolve the conflicts. This is manageable, but can lead to a convoluted history that’s hard to upstream should that ever be necessary, or hard to replicate if you need to do so. Git also allows one to merge, along with the same problems. That’s one way to manage the branch, but it’s the least flexible.

In addition to merging, Git supports the concept of 'rebasing' which avoids these issues. The 'git rebase' command replays all the commits of a branch at a newer location on the parent branch. We will cover the most common scenarios that arise using it. Create a branch

Let’s say you want to make a change to FreeBSD’s ls command to never, ever do color. There are many reasons to do this, but this example will use that as a baseline. The FreeBSD ls command changes from time to time, and you’ll need to cope with those changes. Fortunately, with Git rebase it usually is automatic.

% cd src
% git checkout main
% git checkout -b no-color-ls
% cd bin/ls
% vi ls.c     # hack the changes in
% git diff    # check the changes
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 7378268867ef..cfc3f4342531 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#undef COLORLS
 #ifdef COLORLS
 #include <termcap.h>
 #include <signal.h>
% # these look good, make the commit...
% git commit ls.c

The commit will pop you into an editor to describe what you’ve done. Once you enter that, you have your own local branch in the Git repo. Build and install it like you normally would, following the directions in the handbook. Git differs from other version control systems in that you have to tell it explicitly which files to commit. I have opted to do it on the commit command line, but you can also do it with 'git add' which many of the more in depth tutorials cover. Time to update

When it is time to bring in a new version, it is almost the same as w/o the branches. You would update like you would above, but there is one extra command before you update, and one after. The following assumes you are starting with an unmodified tree. It is important to start rebasing operations with a clean tree (Git requires this).

% git checkout main
% git pull --ff-only
% git rebase -i main no-color-ls

This will bring up an editor that lists all the commits in it. For this example, do not change it at all. This is typically what you are doing while updating the baseline (though you also use the Git rebase command to curate the commits you have in the branch).

Once you are done with the above, you have to move the commits to ls.c forward from the old version of FreeBSD to the newer one.

Sometimes there are merge conflicts. That is OK. Do not panic. Instead, handle them the same as any other merge conflicts. To keep it simple, I will just describe a common issue that may arise. A pointer to a more complete treatment can be found at the end of this section.

Let’s say the includes changes upstream in a radical shift to terminfo as well as a name change for the option. When you updated, you might see something like this:

Auto-merging bin/ls/ls.c
CONFLICT (content): Merge conflict in bin/ls/ls.c
error: could not apply 646e0f9cda11... no color ls
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 646e0f9cda11... no color ls

which looks scary. If you bring up an editor, you will see it is a typical 3-way merge conflict resolution that you may be familiar with from other source code systems (the rest of ls.c has been omitted):

<<<<<<< HEAD
#include <terminfo.h>
#undef COLORLS
#ifdef COLORLS
#include <termcap.h>
>>>>>>> 646e0f9cda11... no color ls

The new code is first, and your code is second. The right fix here is to just add a #undef COLORLS_NEW before #ifdef and then delete the old changes:

#include <terminfo.h>

save the file. The rebase was interrupted, so you have to complete it:

% git add ls.c
% git rebase --continue

which tells Git that ls.c has been fixed and to continue the rebase operation. Since there was a conflict, you will get kicked into the editor to update the commit message if necessary. If the commit message is still accurate, just exit the editor.

If you get stuck during the rebase, do not panic. git rebase --abort will take you back to a clean slate. It is important, though, to start with an unmodified tree. An aside: The above mentioned 'git reflog' comes in handy here, as it will have a list of all the (intermediate) commits that you can view or inspect or cherry-pick.

For more on this topic, provides a rather extensive treatment. It is a good resource for issues that arise occasionally but are too obscure for this guide. Switching to a Different FreeBSD Branch

If you wish to shift from stable/12 to the current branch. If you have a deep clone, the following will suffice:

% git checkout main
% # build and install here...

If you have a local branch, though, there are one or two caveats. First, rebase will rewrite history, so you will likely want to do something to save it. Second, jumping branches tends to cause more conflicts. If we pretend the example above was relative to stable/12, then to move to main, I’d suggest the following:

% git checkout no-color-ls
% git checkout -b no-color-ls-stable-12   # create another name for this branch
% git rebase -i stable/12 no-color-ls --onto main

What the above does is checkout no-color-ls. Then create a new name for it (no-color-ls-stable-12) in case you need to get back to it. Then you rebase onto the main branch. This will find all the commits to the current no-color-ls branch (back to where it meets up with the stable/12 branch) and then it will replay them onto the main branch creating a new no-color-ls branch there (which is why I had you create a place holder name). Migrating from an existing Git clone

If you have work based on a previous Git conversion or a locally running git-svn conversion, migrating to new repository can encounter problems because Git has no knowledge about the connection between the two.

When you have only a few local changes, the easiest way would be to cherry-pick those changes to the new base:

% git checkout main
% git cherry-pick old_branch..your_branch

Or alternatively, do the same thing with rebase:

% git rebase --onto main master your_branch

If you do have a lot of changes, you would probably want to perform a merge instead. The idea is to create a merge point that consolidates the history of the old_branch, and the new FreeBSD repository (main).

You can find out by looking up the same commit that are found on both parents:

% git show old_branch

You will see a commit message, now search for that in the new branch:

% git log --grep="commit message on old_branch" freebsd/main

You would help locate the commit hash on the new main branch, create a helper branch (in the example we call it 'stage') from that hash:

% git checkout -b stage _hash_found_from_git_log_

Then perform a merge of the old branch:

% git merge -s ours -m "Mark old branch as merged" old_branch

With that, it’s possible to merge your work branch or the main branch in any order without problem. Eventually, when you are ready to commit your work back to main, you can perform a rebase to main, or do a squash commit by combining everything into one commit.

5.3. MFC (Merge From Current) Procedures

5.3.1. Summary

MFC workflow can be summarized as git cherry-pick -x plus git commit --amend to adjust the commit message. For multiple commits, use git rebase -i to squash them together and edit the commit message.

5.3.2. Single commit MFC

% git checkout stable/X
% git cherry-pick -x $HASH --edit

For MFC commits, for example a vendor import, you would need to specify one parent for cherry-pick purposes. Normally, that would be the "first parent" of the branch you are cherry-picking from, so:

% git checkout stable/X
% git cherry-pick -x $HASH -m 1 --edit

If things go wrong, you’ll either need to abort the cherry-pick with git cherry-pick --abort or fix it up and do a git cherry-pick --continue.

Once the cherry-pick is finished, push with git push. If you get an error due to losing the commit race, use git pull --rebase and try to push again.

5.3.3. MFC to RELENG branch

MFCs to branches that require approval require a bit more care. The process is the same for either a typical merge or an exceptional direct commit.

  • Merge or direct commit to the appropriate stable/X branch first before merging to the releng/X.Y branch.

  • Use the hash that’s in the stable/X branch for the MFC to releng/X.Y branch.

  • Leave both "cherry picked from" lines in the commit message.

  • Be sure to add the Approved by: line when you are in the editor.

% git checkout releng/13.0
% git cherry-pick -x $HASH --edit

If you forget to to add the Approved by: line, you can do a git commit --amend to edit the commit message before you push the change.

5.3.4. Multiple commit MFC

% git checkout -b tmp-branch stable/X
% for h in $HASH_LIST; do git cherry-pick -x $h; done
% git rebase -i stable/X
# mark each of the commits after the first as 'squash'
# Update the commit message to reflect all elements of commit, if necessary.
# Be sure to retain the "cherry picked from" lines.
% git push freebsd HEAD:stable/X

If the push fails due to losing the commit race, rebase and try again:

% git checkout stable/X
% git pull
% git checkout tmp-branch
% git rebase stable/X
% git push freebsd HEAD:stable/X

Once the MFC is complete, you can delete the temporary branch:

% git checkout stable/X
% git branch -d tmp-branch

5.3.5. MFC a vendor import

Vendor imports are the only thing in the tree that creates a merge commit in the main line. Cherry picking merge commits into stable/XX presents an additional difficulty because there are two parents for a merge commit. Generally, you’ll want the first parent’s diff since that’s the diff to mainline (though there may be some exceptions).

% git cherry-pick -x -m 1 $HASH

is typically what you want. This will tell cherry-pick to apply the correct diff.

There are some, hopefully, rare cases where it’s possible that the mainline was merged backwards by the conversion script. Should that be the case (and we’ve not found any yet), you’d change the above to '-m 2' to pickup the proper parent. Just do

% git cherry-pick --abort
% git cherry-pick -x -m 2 $HASH

to do that. The --abort will cleanup the failed first attempt.

5.3.6. Redoing a MFC

If you do a MFC, and it goes horribly wrong and you want to start over, then the easiest way is to use git reset --hard like so:

% git reset --hard freebsd/stable/12

though if you have some revs you want to keep, and others you don’t, using 'git rebase -i' is better.

5.3.7. Considerations when MFCing

When committing source commits to stable and releng branches, we have the following goals:

  • Clearly mark direct commits distinct from commits that land a change from another branch.

  • Avoid introducing known breakage into stable and releng branches.

  • Allow developers to determine which changes have or have not been landed from one branch to another.

With Subversion, we used the following practices to achieve these goals:

  • Using 'MFC' and 'MFS' tags to mark commits that merged changes from another branch.

  • Squashing fixup commits into the main commit when merging a change.

  • Recording mergeinfo so that svn mergeinfo --show-revs worked.

With Git, we will need to use different strategies to achieve the same goals. This document aims to define best practices when merging source commits using Git that achieve these goals. In general, we aim to use Git’s native support to achieve these goals rather than enforcing practices built on Subversion’s model.

One general note: due to technical differences with Git, we will not be using Git "merge commits" (created via git merge) in stable or releng branches. Instead, when this document refers to "merge commits", it means a commit originally made to main that is replicated or "landed" to a stable branch, or a commit from a stable branch that is replicated to a releng branch with some variation of git cherry-pick.

5.3.8. Finding Eligible Hashes to MFC

Git provides some built-in support for this via the git cherry and git log --cherry commands. These commands compare the raw diffs of commits (but not other metadata such as log messages) to determine if two commits are identical. This works well when each commit from head is landed as a single commit to a stable branch, but it falls over if multiple commits from main are squashed together as a single commit to a stable branch.

There are a few options for resolving this:

  1. We could ban squashing of commits and instead require that committers stage all of the fixup / follow-up commits to stable into a single push. This would still achieve the goal of stability in stable and releng branches since pushes are atomic and users doing a simple pull will never end up with a tree that has the main commit without the fixup(s). git bisect is also able to cope with this model via git bisect skip.

  2. We could adopt a consistent style for describing MFCs and write our own tooling to wrap around git cherry to determine the list of eligible commits. A simple approach here might be to use the syntax from git cherry-pick -x, but require that a squashed commit list all of the hashes (one line per hash) at the end of the commit message. Developers could do this by using git cherry-pick -x of each individual commit into a branch and then use git rebase to squash the commits down into a single commit, but collecting the -x annotations at the end of the landed commit log.

5.3.9. Commit message standards Marking MFCs

The project has adopted the following practice for marking MFCs:

  • Use the -x flag with git cherry-pick. This adds a line to the commit message that includes the hash of the original commit when merging. Since it is added by Git directly, committers do not have to manually edit the commit log when merging.

When merging multiple commits, keep all the "cherry picked from" lines. Trim Metadata?

One area that was not clearly documented with Subversion (or even CVS) is how to format metadata in log messages for MFC commits. Should it include the metadata from the original commit unchanged, or should it be altered to reflect information about the MFC commit itself?

Historical practice has varied, though some of the variance is by field. For example, MFCs that are relevant to a PR generally include the PR field in the MFC so that MFC commits are included in the bug tracker’s audit trail. Other fields are less clear. For example, Phabricator shows the diff of the last commit tagged to a review, so including Phabricator URLs replaces the main commit with the landed commits. The list of reviewers is also not clear. If a reviewer has approved a change to main, does that mean they have approved the MFC commit? Is that true if it’s identical code only, or with merely trivial rework? It’s clearly not true for more extensive reworks. Even for identical code what if the commit doesn’t conflict but introduces an ABI change? A reviewer may have ok’d a commit for main due to the ABI breakage but may not approve of merging the same commit as-is. One will have to use one’s best judgment until clear guidelines can be agreed upon.

For MFCs regulated by [email protected], new metadata fields are added, such as the Approved by tag for approved commits. This new metadata will have to be added via git commit --amend or similar after the original commit has been reviewed and approved. We may also want to reserve some metadata fields in MFC commits such as Phabricator URLs for use by [email protected] in the future.

Preserving existing metadata provides a very simple workflow. Developers can just use git cherry-pick -x without having to edit the log message.

If instead we choose to adjust metadata in MFCs, developers will have to edit log messages explicitly via the use of git cherry-pick --edit or git commit --amend. However, as compared to svn, at least the existing commit message can be pre-populated and metadata fields can be added or removed without having to re-enter the entire commit message.

The bottom line is that developers will likely need to curate their commit message for MFCs that are non-trivial.

5.3.10. Examples Merging a Single Subversion Commit

This walks through the process of merging a commit to stable/12 that was originally committed to head in Subversion. In this case, the original commit is r368685.

The first step is to map the Subversion commit to a Git hash. Once you have fetched refs/notes/commits, you can pass the revision number to git log --grep:

% git log main --grep 368685
commit ce8395ecfda2c8e332a2adf9a9432c2e7f35ea81
Author: John Baldwin <[email protected]>
Date:   Wed Dec 16 00:11:30 2020 +0000

    Use the 't' modifier to print a ptrdiff_t.

    Reviewed by:    imp
    Obtained from:  CheriBSD
    Sponsored by:   DARPA
    Differential Revision:

    svn path=/head/; revision=368685

Next, MFC the commit to a stable/12 checkout:

git checkout stable/12
git cherry-pick -x ce8395ecfda2c8e332a2adf9a9432c2e7f35ea81 --edit

Git will invoke the editor. Use this to remove the metadata that only applied to the original commit (Phabricator URL and Reviewed by). After the editor saves the updated log message, Git completes the commit:

[stable/12 3e3a548c4874] Use the 't' modifier to print a ptrdiff_t.
 Date: Wed Dec 16 00:11:30 2020 +0000
 1 file changed, 1 insertion(+), 1 deletion(-)

The contents of the MFCd commit can be examined via git show:

% git show
commit 3e3a548c487450825679e4bd63d8d1a67fd8bd2d (HEAD -> stable/12)
Author: John Baldwin <[email protected]>
Date:   Wed Dec 16 00:11:30 2020 +0000

    Use the 't' modifier to print a ptrdiff_t.

    Obtained from:  CheriBSD
    Sponsored by:   DARPA

    (cherry picked from commit ce8395ecfda2c8e332a2adf9a9432c2e7f35ea81)

diff --git a/sys/compat/linuxkpi/common/include/linux/printk.h b/sys/compat/linuxkpi/common/include/linux/printk.h
index 31802bdd2c99..e6510e9e9834 100644
--- a/sys/compat/linuxkpi/common/include/linux/printk.h
+++ b/sys/compat/linuxkpi/common/include/linux/printk.h
@@ -68,7 +68,7 @@ print_hex_dump(const char *level, const char *prefix_str,
                        printf("[%p] ", buf);
                case DUMP_PREFIX_OFFSET:
-                       printf("[%p] ", (const char *)((const char *)buf -
+                       printf("[%#tx] ", ((const char *)buf -
                            (const char *)buf_old));

The MFC commit can now be published via git push

% git push freebsd
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 817 bytes | 204.00 KiB/s, done.
Total 9 (delta 5), reused 1 (delta 1), pack-reused 0
   525bd9c9dda7..3e3a548c4874  stable/12 -> stable/12 Merging a Single Subversion Commit with a Conflict

This example is similar to the previous example except that the commit in question encounters a merge conflict. In this case, the original commit is r368314.

As above, the first step is to map the Subversion commit to a Git hash:

% git log main --grep 368314
commit 99963f5343a017e934e4d8ea2371a86789a46ff9
Author: John Baldwin <[email protected]>
Date:   Thu Dec 3 22:01:13 2020 +0000

    Don't transmit mbufs that aren't yet ready on TOE sockets.

    This includes mbufs waiting for data from sendfile() I/O requests, or
    mbufs awaiting encryption for KTLS.

    Reviewed by:    np
    MFC after:      2 weeks
    Sponsored by:   Chelsio Communications
    Differential Revision:

    svn path=/head/; revision=368314

Next, MFC the commit to a stable/12 checkout:

% git checkout stable/12
% git cherry-pick -x 99963f5343a017e934e4d8ea2371a86789a46ff9 --edit
Auto-merging sys/dev/cxgbe/tom/t4_cpl_io.c
CONFLICT (content): Merge conflict in sys/dev/cxgbe/tom/t4_cpl_io.c
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 7123 and retry the command.
error: could not apply 99963f5343a0... Don't transmit mbufs that aren't yet ready on TOE sockets.
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

In this case, the commit encountered a merge conflict in sys/dev/cxge/tom/t4_cpl_io.c as kernel TLS is not present in stable/12. Note that Git does not invoke an editor to adjust the commit message due to the conflict. git status confirms that this file has merge conflicts:

% git status
On branch stable/12
Your branch is up to date with 'upstream/stable/12'.

You are currently cherry-picking commit 99963f5343a0.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   sys/dev/cxgbe/tom/t4_cpl_io.c

no changes added to commit (use "git add" and/or "git commit -a")

After editing the file to resolve the conflict, git status shows the conflict as resolved:

% git status
On branch stable/12
Your branch is up to date with 'upstream/stable/12'.

You are currently cherry-picking commit 99963f5343a0.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
        modified:   sys/dev/cxgbe/tom/t4_cpl_io.c

The cherry-pick can now be completed:

% git cherry-pick --continue

Since there was a merge conflict, Git invokes the editor to adjust the commit message. Trim the metadata fields from the commit log from the original commit to head and save the updated log message.

The contents of the MFC commit can be examined via git show:

% git show
commit 525bd9c9dda7e7c7efad2d4570c7fd8e1a8ffabc (HEAD -> stable/12)
Author: John Baldwin <[email protected]>
Date:   Thu Dec 3 22:01:13 2020 +0000

    Don't transmit mbufs that aren't yet ready on TOE sockets.

    This includes mbufs waiting for data from sendfile() I/O requests, or
    mbufs awaiting encryption for KTLS.

    Sponsored by:   Chelsio Communications

    (cherry picked from commit 99963f5343a017e934e4d8ea2371a86789a46ff9)

diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index 8e8c2b8639e6..43861f10b689 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -746,6 +746,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)
                for (m = sndptr; m != NULL; m = m->m_next) {
                        int n;

+                       if ((m->m_flags & M_NOTAVAIL) != 0)
+                               break;
                        if (IS_AIOTX_MBUF(m))
                                n = sglist_count_vmpages(aiotx_mbuf_pages(m),
                                    aiotx_mbuf_pgoff(m), m->m_len);
@@ -821,8 +823,9 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)

                /* nothing to send */
                if (plen == 0) {
-                       KASSERT(m == NULL,
-                           ("%s: nothing to send, but m != NULL", __func__));
+                       KASSERT(m == NULL || (m->m_flags & M_NOTAVAIL) != 0,
+                           ("%s: nothing to send, but m != NULL is ready",
+                           __func__));

@@ -910,7 +913,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)

                t4_l2t_send(sc, wr, toep->l2te);
-       } while (m != NULL);
+       } while (m != NULL && (m->m_flags & M_NOTAVAIL) == 0);

        /* Send a FIN if requested, but only if there's no more data to send */
        if (m == NULL && toep->flags & TPF_SEND_FIN)

The MFC commit can now be published via git push

git push freebsd
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 819 bytes | 117.00 KiB/s, done.
Total 7 (delta 6), reused 0 (delta 0), pack-reused 0
   f4d0bc6aa6b9..525bd9c9dda7  stable/12 -> stable/12

5.4. Vendor Imports with Git

This section describes the vendor import procedure with Git in detail.

5.4.1. Branch naming convention

All vendor branches and tags start with vendor/. These branches and tags are visible by default.

This chapter follows the convention that the freebsd origin is the origin name for the official FreeBSD Git repository. If you use a different convention, replace freebsd with the name you use instead in the examples below.

We will explore an example for updating NetBSD’s mtree that is in our tree. The vendor branch for this is vendor/NetBSD/mtree.

5.4.2. Updating an old vendor import

The vendor trees usually have only the subset of the third-party software that is appropriate to FreeBSD. These trees are usually tiny in comparison to the FreeBSD tree. Git worktrees are thus quite small and fast and the preferred method to use. Make sure that whatever directory you choose below (the ../mtree) does not currently exist.

% git worktree add ../mtree vendor/NetBSD/mtree

5.5. Creating a new vendor branch

5.5.3. Now import it into our repository

Now you need to import the branch into our repository.

% cd /path/to/freebsd/repo/src
% git remote add glorbnitz /some/where/glorbnitz
% git fetch glorbnitz vendor/glorbnitz

Note the vendor/glorbnitz branch is in the repo. At this point the /some/where/glorbnitz can be deleted, if you like. It was only a means to an end.

5.5.4. Tag and push

Steps from here on out are much the same as they are in the case of updating a vendor branch, though without the updating the vendor branch step.

% git worktree add ../glorbnitz vendor/glorbnitz
% cd ../glorbnitz
% git tag --annotate vendor/glorbnitz/3.1415
# Make sure the commit is good with "git show"
% git push --follow-tags freebsd vendor/glorbnitz

By 'good' we mean:

  1. All the right files are present

  2. None of the wrong files are present

  3. The vendor branch points at something sensible

  4. The tag looks good, and is annotated

  5. The commit message for the tag has a quick summary of what’s new since the last tag

5.5.5. Time to finally merge it into the base tree

% cd ../src
% git subtree add -P contrib/glorbnitz vendor/glorbnitz
# Make sure the commit is good with "git show"
% git commit --amend   # one last sanity check on commit message
% git push freebsd

Here 'good' means:

  1. All the right files, and none of the wrong ones, were merged into contrib/glorbnitz.

  2. No other changes are in the tree.

  3. The commit messages look good. It should contain a summary of what’s changed since the last merge to the FreeBSD main line and any caveats.

  4. UPDATING should be updated if there is anything of note, such as user visible changes, important upgrade concerns, etc.

This hasn’t connected glorbnitz to the build yet. How so do that is specific to the software being imported and is beyond the scope of this tutorial.

5.6. FreeBSD Src Committer Transition Guide

This section is designed to walk people through the conversion process from Subversion to Git, written from the source committer’s point of view.

5.6.1. Migrating from a Subversion tree

This section will cover a couple of common scenarios for migrating from using the FreeBSD Subversion repo to the FreeBSD source Git repo. The FreeBSD Git conversion is still in beta status, so some minor things may change between this and going into production.

The first thing to do is install Git. Any version of Git will do, though the latest one in ports / packages generally will be good. Either build it from ports, or install it using pkg (though some folks might use su or doas instead of sudo):

% sudo pkg install git No staged changes migration

If you have no changes pending, the migration is straightforward. In this, you abandon the Subversion tree and clone the Git repository. It’s likely best to retain your Subversion tree, in case there’s something you’ve forgotten about there. First, let’s clone the repository:

% git clone -o freebsd --config remote.freebsd.fetch='+refs/notes/*:refs/notes/*' freebsd-src

will create a clone of the FreeBSD src repository into a subdirectory called freebsd-src and include the 'notes' about the revisions. We are currently mirroring the source repository to as well. has the old GitHub mirror with the old hashes should you need that for your migration. The GitHub master branch has been frozen. As the default in Git has changed, we’ve shifted from master to main; the new repository uses main. We also mirror the repository to GitLab at .

It’s useful to have the old Subversion revisions available. This data is stored using Git notes, but Git doesn’t fetch those by default. The --config and the argument above changed the default to fetch the notes. If you’ve cloned the repository without this, or wish to add notes to a previously cloned repository, use the following commands:

% git config --add remote.freebsd.fetch "+refs/notes/*:refs/notes/*"
% git fetch

At this point you have the src checked out into a Git tree, ready to do other things. But I have changes that I’ve not committed

If you are migrating from a tree that has changes you’ve not yet committed to FreeBSD, you’ll need to follow the steps from the previous section first, and then follow these.

% cd path-to-svn-checkout-tree
% svn diff > /tmp/src.diff
% cd _mumble_/freebsd-src
% git checkout -b working

This will create a diff of your current changes. The last command creates a branch called working though you can call it whatever you want.

% git apply /tmp/src.diff

this will apply all your pending changes to the working tree. This doesn’t commit the change, so you’ll need to make this permanent:

% git add _files_
% git commit

The last command will commit these changes to the branch. The editor will prompt you for a commit message. Enter one as if you were committing to FreeBSD.

At this point, your work is preserved, and in the Git repository. Keeping current

So, time passes. It’s time now to update the tree for the latest changes upstream. When you checkout main make sure that you have no diffs. It’s a lot easier to commit those to a branch (or use git stash) before doing the following.

If you are used to git pull, we strongly recommend using the --ff-only option, and further setting it as the default option. Alternatively, git pull --rebase is useful if you have changes staged in the main branch.

% git config --global pull.ff only

You may need to omit the --global if you want this setting to apply to only this repository.

% cd freebsd-src
% git checkout main
% git pull (--ff-only|--rebase)

There is a common trap, that the combination command git pull will try to perform a merge, which would sometimes creates a merge commit that didn’t exist before. This can be harder to recover from.

The longer form is also recommended.

% cd freebsd-src
% git checkout main
% git fetch freebsd
% git merge --ff-only freebsd/main

These commands reset your tree to the main branch, and then update it from where you pulled the tree from originally. It’s important to switch to main before doing this so it moves forward. Now, it’s time to move the changes forward:

% git rebase -i main working

This will bring up an interactive screen to change the defaults. For now, just exit the editor. Everything should just apply. If not, then you’ll need to resolve the diffs. This github document can help you navigate this process. Time to push changes upstream

First, ensure that the push URL is properly configured for the upstream repository.

% git remote set-url --push freebsd ssh://[email protected]/src.git

Then, verify that user name and email are configured right. We require that they exactly match the passwd entry in FreeBSD cluster.



on to get a recipe that you can use directly, assuming /usr/local/bin is in the PATH.

The below command merges the working branch into the upstream main line. It’s important that you curate your changes to be just like you want them in the FreeBSD source repo before doing this. This syntax pushes the working branch to main, moving the main branch forward. You will only be able to do this if this results in a linear change to main (e.g. no merges).

% git push freebsd working:main

If your push is rejected due to losing a commit race, rebase your branch before trying again:

% git checkout working
% git fetch freebsd
% git rebase freebsd/main
% git push freebsd working:main Time to push changes upstream (alternative)

Some people find it easier to merge their changes to their local main before pushing to the remote repository. Also, git arc stage moves changes from a branch to the local main when you need to do a subset of a branch. The instructions are similar to the prior section:

% git checkout main
% git merge --ff-only `working`
% git push freebsd

If you lose the race, then try again with

% git pull --rebase
% git push freebsd

These commands will fetch the most recent freebsd/main and then rebase the local main changes on top of that, which is what you want when you lose the commit race. Note: merging vendor branch commits will not work with this technique. Finding the Subversion Revision

You’ll need to make sure that you’ve fetched the notes (see the No staged changes migration section above for details. Once you have these, notes will show up in the git log command like so:

% git log

If you have a specific version in mind, you can use this construct:

% git log --grep revision=XXXX

to find the specific revision. The hex number after 'commit' is the hash you can use to refer to this commit.

5.6.2. Migrating from GitHub fork

Note: as of this writing, is mirroring all official branches, along with a master branch which is the legacy svn2git result. The master branch will not be updated anymore, and the last commit contains the instructions for migrating to the new main branch. We’ll retain the master branch for a certain time, but in the future it will only be kept in the freebsd-legacy repository. In addition, this article has an earlier version of the last commit instructions that may be helpful.

When migrating branches from a GitHub fork from the old GitHub mirror to the official repo, the process is straight forward. This assumes that you have a freebsd upstream pointing to GitHub, adjust if necessary. This also assumes a clean tree before starting…​ Add the new freebsd upstream repository:
% git remote add freebsd
% git fetch freebsd
% git checkout --track freebsd/main Rebase all your WIP branches.

For each branch FOO, do the following after fetching the freebsd sources and creating a local main branch with the above checkout:

% git rebase -i freebsd/master FOO --onto main

And you’ll now be tracking the official repository. You can then follow the Keeping Current section above to stay up to date.

If you need to then commit work to FreeBSD, you can do so following the Time to push changes upstream instructions. You’ll need to do the following once to update the push URL if you are a FreeBSD committer:

% git remote set-url --push freebsd ssh://[email protected]/src.git

(note that will be change to in the future.)

You will also need to add freebsd as the location to push to. The author recommends that your upstream GitHub repository remain the default push location so that you only push things into FreeBSD you intend to by making it explicit.

5.7. Git FAQ

This section provides a number of targeted answers to questions that are likely to come up often for users and developers.

We use the common convention of having the origin for the FreeBSD repository being 'freebsd' rather than the default 'origin' to allow people to use that for their own development and to minimize "whoops" pushes to the wrong repository.

5.7.1. Users How do I track -current and -stable with only one copy of the repository?

Q: Although disk space is not a huge issue, it’s more efficient to use only one copy of the repository. With SVN mirroring, I could checkout multiple trees from the same repository. How do I do this with Git?

A: You can use Git worktrees. There’s a number of ways to do this, but the simplest way is to use a clone to track -current, and a worktree to track stable releases. While using a 'bare repository' has been put forward as a way to cope, it’s more complicated and will not be documented here.

First, you need to clone the FreeBSD repository, shown here cloning into freebsd-current to reduce confusion. $URL is whatever mirror works best for you:

% git clone -o freebsd --config remote.freebsd.fetch='+refs/notes/*:refs/notes/*' $URL freebsd-current

then once that’s cloned, you can simply create a worktree from it:

% cd freebsd-current
% git worktree add ../freebsd-stable-12 stable/12

this will checkout stable/12 into a directory named freebsd-stable-12 that’s a peer to the freebsd-current directory. Once created, it’s updated very similarly to how you might expect:

% cd freebsd-current
% git checkout main
% git pull --ff-only
# changes from upstream now local and current tree updated
% cd ../freebsd-stable-12
% git merge --ff-only freebsd/stable/12
# now your stable/12 is up to date too

I recommend using --ff-only because it’s safer and you avoid accidentally getting into a 'merge nightmare' where you have an extra change in your tree, forcing a complicated merge rather than a simple one.

Here’s a good writeup that goes into more detail.

5.7.2. Developers Ooops! I committed to main instead of a branch.

Q: From time to time, I goof up and commit to main instead of to a branch. What do I do?

A: First, don’t panic.

Second, don’t push. In fact, you can fix almost anything if you haven’t pushed. All the answers in this section assume no push has happened.

The following answer assumes you committed to main and want to create a branch called issue:

% git branch issue                # Create the 'issue' branch
% git reset --hard freebsd/main   # Reset 'main' back to the official tip
% git checkout issue              # Back to where you were Ooops! I committed something to the wrong branch!

Q: I was working on feature on the wilma branch, but accidentally committed a change relevant to the fred branch in 'wilma'. What do I do?

A: The answer is similar to the previous one, but with cherry picking. This assumes there’s only one commit on wilma, but will generalize to more complicated situations. It also assumes that it’s the last commit on wilma (hence using wilma in the git cherry-pick command), but that too can be generalized.

# We're on branch wilma
% git checkout fred		# move to fred branch
% git cherry-pick wilma		# copy the misplaced commit
% git checkout wilma		# go back to wilma branch
% git reset --hard HEAD^	# move what wilma refers to back 1 commit

Git experts would first rewind the wilma branch by 1 commit, switch over to fred and then use git reflog to see what that 1 deleted commit was and cherry-pick it over.

Q: But what if I want to commit a few changes to main, but keep the rest in wilma for some reason?

A: The same technique above also works if you are wanting to 'land' parts of the branch you are working on into main before the rest of the branch is ready (say you noticed an unrelated typo, or fixed an incidental bug). You can cherry pick those changes into main, then push to the parent repository. Once you’ve done that, cleanup couldn’t be simpler: just git rebase -i. Git will notice you’ve done this and skip the common changes automatically (even if you had to change the commit message or tweak the commit slightly). There’s no need to switch back to wilma to adjust it: just rebase!

Q: I want to split off some changes from branch wilma into branch fred

A: The more general answer would be the same as the previous. You’d checkout/create the fred branch, cherry pick the changes you want from wilma one at a time, then rebase wilma to remove those changes you cherry picked. git rebase -i main wilma will toss you into an editor, and remove the pick lines that correspond to the commits you copied to fred. If all goes well, and there are no conflicts, you’re done. If not, you’ll need to resolve the conflicts as you go.

The other way to do this would be to checkout wilma and then create the branch fred to point to the same point in the tree. You can then git rebase -i both these branches, selecting the changes you want in fred or wilma by retaining the pick likes, and deleting the rest from the editor. Some people would create a tag/branch called pre-split before starting in case something goes wrong in the split. You can undo it with the following sequence:

% git checkout pre-split	# Go back
% git branch -D fred		# delete the fred branch
% git checkout -B wilma		# reset the wilma branch
% git branch -d pre-split	# Pretend it didn't happen

The last step is optional. If you are going to try again to split, you’d omit it.

Q: But I did things as I read along and didn’t see your advice at the end to create a branch, and now fred and wilma are all screwed up. How do I find what wilma was before I started. I don’t know how many times I moved things around.

A: All is not lost. You can figure out it, so long as it hasn’t been too long, or too many commits (hundreds).

So I created a wilma branch and committed a couple of things to it, then decided I wanted to split it into fred and wilma. Nothing weird happened when I did that, but let’s say it did. The way to look at what you’ve done is with the git reflog:

% git reflog
6ff9c25 (HEAD -> wilma) [email protected]{0}: rebase -i (finish): returning to refs/heads/wilma
6ff9c25 (HEAD -> wilma) [email protected]{1}: rebase -i (start): checkout main
869cbd3 [email protected]{2}: rebase -i (start): checkout wilma
a6a5094 (fred) [email protected]{3}: rebase -i (finish): returning to refs/heads/fred
a6a5094 (fred) [email protected]{4}: rebase -i (pick): Encourage contributions
1ccd109 (freebsd/main, main) [email protected]{5}: rebase -i (start): checkout main
869cbd3 [email protected]{6}: rebase -i (start): checkout fred
869cbd3 [email protected]{7}: checkout: moving from wilma to fred
869cbd3 [email protected]{8}: commit: Encourage contributions

Here we see the changes I’ve made. You can use it to figure out where things went wrong. I’ll just point out a few things here. The first one is that [email protected]{X} is a 'commitish' thing, so you can use that as an argument to a command. Although if that command commits anything to the repository, the X numbers change. You can also use the hash (first column).

Next, 'Encourage contributions' was the last commit I made to wilma before I decided to split things up. You can also see the same hash is there when I created the fred branch to do that. I started by rebasing fred and you see the 'start', each step, and the 'finish' for that process. While we don’t need it here, you can figure out exactly what happened. Fortunately, to fix this, you can follow the prior answer’s steps, but with the hash 869cbd3 instead of pre-split. While that seems a bit verbose, it’s easy to remember since you’re doing one thing at a time. You can also stack:

% git checkout -B wilma 869cbd3
% git branch -D fred

and you are ready to try again. The 'checkout -B' with the hash combines checking out and creating a branch for it. The -B instead of -b forces the movement of a pre-existing branch. Either way works, which is what’s great (and awful) about Git. One reason I tend to use git checkout -B xxxx hash instead of checking out the hash, and then creating / moving the branch is purely to avoid the slightly distressing message about detached heads:

% git checkout 869cbd3
Note: checking out '869cbd3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 869cbd3 Encourage contributions
% git checkout -B wilma

this produces the same effect, but I have to read a lot more and severed heads aren’t an image I like to contemplate. Ooops! I did a git pull and it created a merge commit, what do I do?

Q: I was on autopilot and did a git pull for my development tree and that created a merge commit on the mainline. How do I recover?

A: This can happen when you invoke the pull with your development branch checked out.

Right after the pull, you will have the new merge commit checked out. Git supports a HEAD^# syntax to examine the parents of a merge commit:

git log --oneline HEAD^1   # Look at the first parent's commits
git log --oneline HEAD^2   # Look at the second parent's commits

From those logs, you can easily identify which commit is your development work. Then you simply reset your branch to the corresponding HEAD^#:

git reset --hard HEAD^2

Q: But I also need to fix my main branch. How do I do that?

A: Git keeps track of the remote repository branches in a freebsd/ namespace. To fix your main branch, just make it point to the remote’s main:

git branch -f main freebsd/main

There’s nothing magical about branches in Git: they are just labels on a graph that are automatically moved forward by making commits. So the above works because you’re just moving a label. There’s no metadata about the branch that needs to be preserved due to this. Mixing and matching branches

Q: So I have two branches worker and async that I’d like to combine into one branch called feature while maintaining the commits in both.

A: This is a job for cherry pick.

% git checkout worker
% git checkout -b feature	# create a new branch
% git cherry-pick main..async	# bring in the changes

You now have a new branch called feature. This branch combines commits from both branches. You can further curate it with git rebase.

Q: I have a branch called driver and I’d like to break it up into kernel and userland so I can evolve them separately and commit each branch as it becomes ready.

A: This takes a little bit of prep work, but git rebase will do the heavy lifting here.

% git checkout driver		# Checkout the driver
% git checkout -b kernel	# Create kernel branch
% git checkout -b userland	# Create userland branch

Now you have two identical branches. So, it’s time to separate out the commits. We’ll assume first that all the commits in driver go into either the kernel or the userland branch, but not both.

% git rebase -i main kernel

and just include the changes you want (with a 'p' or 'pick' line) and just delete the commits you don’t (this sounds scary, but if worse comes to worse, you can throw this all away and start over with the driver branch since you’ve not yet moved it).

% git rebase -i main userland

and do the same thing you did with the kernel branch.

Q: Oh great! I followed the above and forgot a commit in the kernel branch. How do I recover?

A: You can use the driver branch to find the hash of the commit is missing and cherry pick it.

% git checkout kernel
% git log driver
% git cherry-pick $HASH

Q: OK. I have the same situation as the above, but my commits are all mixed up. I need parts of one commit to go to one branch and the rest to go to the other. In fact, I have several. Your rebase method to select sounds tricky.

A: In this situation, you’d be better off to curate the original branch to separate out the commits, and then use the above method to split the branch.

So let’s assume that there’s just one commit with a clean tree. You can either use git rebase with an edit line, or you can use this with the commit on the tip. The steps are the same either way. The first thing we need to do is to back up one commit while leaving the changes uncommitted in the tree:

% git reset HEAD^

Note: Do not, repeat do not, add --hard here since that also removes the changes from your tree.

Now, if you are lucky, the change needing to be split up falls entirely along file lines. In that case you can just do the usual git add for the files in each group than do a git commit. Note: when you do this, you’ll lose the commit message when you do the reset, so if you need it for some reason, you should save a copy (though git log $HASH can recover it).

If you are not lucky, you’ll need to split apart files. There’s another tool to do that which you can apply one file at a time.

git add -i foo/bar.c

will step through the diffs, prompting you, one at time, whether to include or exclude the hunk. Once you’re done, git commit and you’ll have the remainder in your tree. You can run it multiple times as well, and even over multiple files (though I find it easier to do one file at a time and use the git rebase -i to fold the related commits together).

5.7.3. Cloning and Mirroring

Q: I’d like to mirror the entire Git repository, how do I do that?

A: If all you want to do is mirror, then

% git clone --mirror $URL

will do the trick. However, there are two disadvantages to this if you want to use it for anything other than a mirror you’ll reclone.

First, this is a 'bare repository' which has the repository database, but no checked out worktree. This is great for mirroring, but terrible for day to day work. There’s a number of ways around this with 'git worktree':

% git clone --mirror ports.git
% cd ports.git
% git worktree add ../ports main
% git worktree add ../quarterly branches/2020Q4
% cd ../ports

But if you aren’t using your mirror for further local clones, then it’s a poor match.

The second disadvantage is that Git normally rewrites the refs (branch name, tags, etc) from upstream so that your local refs can evolve independently of upstream. This means that you’ll lose changes if you are committing to this repository on anything other than private project branches.

Q: So what can I do instead?

A: Well, you can stuff all of the upstream repository’s refs into a private namespace in your local repository. Git clones everything via a 'refspec' and the default refspec is:

        fetch = +refs/heads/*:refs/remotes/freebsd/*

which says just fetch the branch refs.

However, the FreeBSD repository has a number of other things in it. To see those, you can add explicit refspecs for each ref namespace, or you can fetch everything. To setup your repository to do that:

git config --add remote.freebsd.fetch '+refs/*:refs/freebsd/*'

which will put everything in the upstream repository into your local repository’s 'refs/freebsd/' namespace. Please note, that this also grabs all the unconverted vendor branches and the number of refs associated with them is quite large.

You’ll need to refer to these 'refs' with their full name because they aren’t in and of Git’s regular namespaces.

git log refs/freebsd/vendor/zlib/1.2.10

would look at the log for the vendor branch for zlib starting at 1.2.10.

5.8. Collaborating with others

One of the keys to good software development on a project as large as FreeBSD is the ability to collaborate with others before you push your changes to the tree. The FreeBSD project’s Git repositories do not, yet, allow user-created branches to be pushed to the repository, and therefore if you wish to share your changes with others you must use another mechanism, such as a hosted GitLab or GitHub, in order to share changes in a user-generated branch.

The following instructions show how to set up a user-generated branch, based on the FreeBSD main branch, and push it to GitHub.

Before you begin, make sure that your local Git repo is up to date and has the correct origins set as shown above.

% git remote -v
freebsd (fetch)
freebsd ssh://[email protected]/src.git (push)

The first step is to create a fork of FreeBSD on GitHub following these guidelines. The destination of the fork should be your own, personal, GitHub account (gvnn3 in my case).

Now add a remote on your local system that points to your fork:

% git remote add github [email protected]:gvnn3/freebsd-src.git
% git remote -v
github	[email protected]:gvnn3/freebsd-src.git (fetch)
github	[email protected]:gvnn3/freebsd-src.git (push)
freebsd (fetch)
freebsd	ssh://[email protected]/src.git (push)

With this in place you can create a branch as shown above.

% git checkout -b gnn-pr2001-fix

Make whatever modifications you wish in your branch. Build, test, and once you’re ready to collaborate with others it’s time to push your changes into your hosted branch. Before you can push you’ll have to set the appropriate upstream, as Git will tell you the first time you try to push to your github remote:

% git push github
fatal: The current branch gnn-pr2001-fix has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream github gnn-pr2001-fix

Setting the push as git advises allows it to succeed:

% git push --set-upstream github gnn-feature
Enumerating objects: 20486, done.
Counting objects: 100% (20486/20486), done.
Delta compression using up to 8 threads
Compressing objects: 100% (12202/12202), done.
Writing objects: 100% (20180/20180), 56.25 MiB | 13.15 MiB/s, done.
Total 20180 (delta 11316), reused 12972 (delta 7770), pack-reused 0
remote: Resolving deltas: 100% (11316/11316), completed with 247 local objects.
remote: Create a pull request for 'gnn-feature' on GitHub by visiting:
 * [new branch]                gnn-feature -> gnn-feature
Branch 'gnn-feature' set up to track remote branch 'gnn-feature' from 'github'.

Subsequent changes to the same branch will push correctly by default:

% git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 314 bytes | 1024 bytes/s, done.
Total 3 (delta 1), reused 1 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
   9e5243d7b659..cf6aeb8d7dda  gnn-feature -> gnn-feature

At this point your work is now in your branch on GitHub and you can share the link with other collaborators.

5.9. Landing a github pull request

This section documents how to land a GitHub pull request that’s submitted against the FreeBSD Git mirrors at GitHub. While this is not an official way to submit patches at this time, sometimes good fixes come in this way and it is easiest just to bring them into a committer’s tree and have them pushed into the FreeBSD’s tree from there. Similar steps can be used to pull branches from other repositories and land those. When committing pull requests from others, one should take extra care to examine all the changes to ensure they are exactly as represented.

Before beginning, make sure that the local Git repo is up to date and has the correct origins set as shown above. In addition, make sure to have the following origins:

% git remote -v
freebsd (fetch)
freebsd ssh://[email protected]/src.git (push)
github (fetch)
github (fetch)

Often pull requests are simple: requests that contain only a single commit. In this case, a streamlined approach may be used, though the approach in the prior section will also work. Here, a branch is created, the change is cherry picked, the commit message adjusted, and sanity-checked before being pushed. The branch staging is used in this example but it can be any name. This technique works for any number of commits in the pull request, especially when the changes apply cleanly to the FreeBSD tree. However, when there’s multiple commits, especially when minor adjustments are needed, git rebase -i works better than git cherry-pick. Briefly, these commands create a branch; cherry-picks the changes from the pull request; tests it; adjusts the commit messages; and fast forward merges it back to main. The PR number is $PR below. When adjusting the message, add Pull Request:$PR. All pull requests committed to the FreeBSD repository should be reviewed by at least one person. This need not be the person committing it, but in that case the person committing it should trust the other reviewers competence to review the commit. Committers that do a code review of pull requests before pushing them into the repo should add a Reviewed by: line to the commit, because in this case it is not implicit. Add anybody that reviews and approves the commit on github to Reviewed by: as well. As always, care should be taken to ensure the change does what it is supposed to, and that no malicious code is present.

In addition, please check to make sure that the pull request author name is not anonymous. Github’s web editing interface generates names like:

Author:     github-user <[email protected]>

A polite request to the author for a better name and/or email should be made. Extra care should be taken to ensure no style issue or malicious code is introduced.

% git fetch github pull/$PR/head:staging
% git rebase -i main staging	# to move the staging branch forward, adjust commit message here
<do testing here, as needed>
% git checkout main
% git pull --ff-only		# to get the latest if time has passed
% git checkout main
% git merge --ff-only staging
<test again if needed>
% git push freebsd --push-option=confirm-author

For complicated pull requests that have multiple commits with conflicts, follow the following outline.

  1. checkout the pull request git checkout github/pull/XXX

  2. create a branch to rebase git checkout -b staging

  3. rebase the staging branch to the latest main with git rebase -i main staging

  4. resolve conflicts and do whatever testing is needed

  5. fast forward the staging branch into main as above

  6. final sanity check of changes to make sure all is well

  7. push to FreeBSD’s Git repository.

This will also work when bringing branches developed elsewhere into the local tree for committing.

Once finished with the pull request, close it using GitHub’s web interface. It is worth noting that if your github origin uses https://, the only step you’ll need a GitHub account for is closing the pull request.

6. Version Control History

The project has moved to git.

The FreeBSD source repository switched from CVS to Subversion on May 31st, 2008. The first real SVN commit is r179447. The source repository switched from Subversion to Git on December 23rd, 2020. The last real svn commit is r368820. The first real git commit hash is 5ef5f51d2bef80b0ede9b10ad5b0e9440b60518c.

The FreeBSD doc/www repository switched from CVS to Subversion on May 19th, 2012. The first real SVN commit is r38821. The documentation repository switched from Subversion to Git on December 8th, 2020. The last SVN commit is r54737. The first real git commit hash is 3be01a475855e7511ad755b2defd2e0da5d58bbe.

The FreeBSD ports repository switched from CVS to Subversion on July 14th, 2012. The first real SVN commit is r300894. The ports repository switched from Subversion to Git on April 6, 2021. The last SVN commit is r569609 The first real git commit hash is ed8d3eda309dd863fb66e04bccaa513eee255cbf.

7. Setup, Conventions, and Traditions

There are a number of things to do as a new developer. The first set of steps is specific to committers only. These steps must be done by a mentor for those who are not committers.

7.1. For New Committers

Those who have been given commit rights to the FreeBSD repositories must follow these steps.

  • Get mentor approval before committing each of these changes!

  • All src commits go to FreeBSD-CURRENT first before being merged to FreeBSD-STABLE. The FreeBSD-STABLE branch must maintain ABI and API compatibility with earlier versions of that branch. Do not merge changes that break this compatibility.

Steps for New Committers

  1. Add an Author Entity

    doc/shared/authors.adoc - Add an author entity. Later steps depend on this entity, and missing this step will cause the doc/ build to fail. This is a relatively easy task, but remains a good first test of version control skills.

  2. Update the List of Developers and Contributors

    doc/shared/contrib-committers.adoc - Add an entry, which will then appear in the "Developers" section of the Contributors List. Entries are sorted by last name.

    doc/shared/contrib-additional.adoc - Remove the entry. Entries are sorted by first name.

  3. Add a News Item

    doc/website/data/en/news/news.toml - Add an entry. Look for the other entries that announce new committers and follow the format. Use the date from the commit bit approval email from [email protected].

  4. Add a PGP Key

    Dag-Erling Smørgrav <[email protected]> has written a shell script (doc/documentation/tools/ to make this easier. See the

    It is very important to have a current PGP/GnuPG key in the repository. The key may be required for positive identification of a committer. For example, the FreeBSD Administrators <[email protected]> might need it for account recovery. A complete keyring of users is available for download from

  5. Update Mentor and Mentee Information

  6. Generate a Kerberos Password

    See Kerberos and LDAP web Password for FreeBSD Cluster to generate or set a Kerberos for use with other FreeBSD services like the bug tracking database.

  7. Optional: Enable Wiki Account

  8. Optional: Update Wiki Information

    Wiki Information - After gaining access to the wiki, some people add entries to the , , and pages.

  9. Optional: Update Ports with Personal Information

  10. Optional: Prevent Duplicate Mailings

7.2. For Everyone

  1. Introduce yourself to the other developers, otherwise no one will have any idea who you are or what you are working on. The introduction need not be a comprehensive biography, just write a paragraph or two about who you are, what you plan to be working on as a developer in FreeBSD, and who will be your mentor. Email this to the FreeBSD developers mailing list and you will be on your way!

  2. Log into and create a /var/forward/user (where user is your username) file containing the e-mail address where you want mail addressed to to be forwarded. This includes all of the commit messages as well as any other mail addressed to the FreeBSD committer’s mailing list and the FreeBSD developers mailing list. Really large mailboxes which have taken up permanent residence on freefall may get truncated without warning if space needs to be freed, so forward it or save it elsewhere.

    If your e-mail system uses SPF with strict rules, you should exclude from SPF checks.

    Those who are developers but not committers will not be subscribed to the committers or developers mailing lists. The subscriptions are derived from the access rights.

7.2.1. SMTP Access Setup

  1. Point your mail client at

  2. Enable STARTTLS.

  3. Ensure your From: address is set to

  4. For authentication, you can use your FreeBSD Kerberos username and password (see Kerberos and LDAP web Password for FreeBSD Cluster). The yourusername/mail principal is preferred, as it is only valid for authenticating to mail resources.

    Do not include when entering in your username.

    Additional Notes
    • Will only accept mail from If you are authenticated as one user, you are not permitted to send mail from another.

    • A header will be appended with the SASL username: (Authenticated sender: username).

    • Host has various rate limits in place to cut down on brute force attempts. Using a Local MTA to Forward Emails to the SMTP Service

It is also possible to use a local MTA to forward locally sent emails to the SMTP servers.

Example 1. Using Postfix

To tell a local Postfix instance that anything from should be forwarded to the servers, add this to your

sender_dependent_relayhost_maps = hash:/usr/local/etc/postfix/relayhost_maps
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_use_tls = yes

Create /usr/local/etc/postfix/relayhost_maps with the following content:

[email protected]  []:587

Create /usr/local/etc/postfix/sasl_passwd with the following content:

[]:587          yourusername:yourpassword

If the email server is used by other people, you may want to prevent them from sending e-mails from your address. To achieve this, add this to your

smtpd_sender_login_maps = hash:/usr/local/etc/postfix/sender_login_maps
smtpd_sender_restrictions = reject_known_sender_login_mismatch

Create /usr/local/etc/postfix/sender_login_maps with the following content:

[email protected] yourlocalusername

Where yourlocalusername is the SASL username used to connect to the local instance of Postfix.

Example 2. Using OpenSMTPD

To tell a local OpenSMTPD instance that anything from should be forwarded to the servers, add this to your smtpd.conf:

action "freebsd" relay host smtp+tls://[email protected]:587 auth <secrets>
match from any auth yourlocalusername mail-from "[email protected]" for any action "freebsd"

Where yourlocalusername is the SASL username used to connect to the local instance of OpenSMTPD.

Create /usr/local/etc/mail/secrets with the following content:

freebsd	yourusername:yourpassword
Example 3. Using Exim

To direct a local Exim instance to forward all mail from to servers, add this to Exim configuration:

Routers section: (at the top of the list):
   driver = manualroute
   domains = !+local_domains
   transport = freebsd_smtp
   route_data = ${lookup {${lc:$sender_address}} lsearch {/usr/local/etc/exim/freebsd_send}}

Transport Section:
        driver = smtp
  tls_certificate=<local certificate>
  tls_privatekey=<local certificate private key>
  dkim_domain = <local DKIM domain>
  dkim_selector = <local DKIM selector>
  dkim_private_key= <local DKIM private key>
  dnssec_request_domains = *
  hosts_require_auth =

  driver = plaintext
  public_name = PLAIN
  client_send = ^example/mail^examplePassword

Create /usr/local/etc/exim/freebsd_send with the following content:

[email protected]

7.3. Mentors

All new developers have a mentor assigned to them for the first few months. A mentor is responsible for teaching the mentee the rules and conventions of the project and guiding their first steps in the developer community. The mentor is also personally responsible for the mentee’s actions during this initial period.

For committers: do not commit anything without first getting mentor approval. Document that approval with an Approved by: line in the commit message.

When the mentor decides that a mentee has learned the ropes and is ready to commit on their own, the mentor announces it with a commit to mentors. This file is in the admin orphan branch of each repository. Detailed information on how to access these branches can be found in "admin" branch.

8. Pre-Commit Review

Code review is one way to increase the quality of software. The following guidelines apply to commits to the head (-CURRENT) branch of the src repository. Other branches and the ports and docs trees have their own review policies, but these guidelines generally apply to commits requiring review:

  • All non-trivial changes should be reviewed before they are committed to the repository.

  • Reviews may be conducted by email, in Bugzilla, in Phabricator, or by another mechanism. Where possible, reviews should be public.

  • The developer responsible for a code change is also responsible for making all necessary review-related changes.

  • Code review can be an iterative process, which continues until the patch is ready to be committed. Specifically, once a patch is sent out for review, it should receive an explicit "looks good" before it is committed. So long as it is explicit, this can take whatever form makes sense for the review method.

  • Timeouts are not a substitute for review.

Sometimes code reviews will take longer than you would hope for, especially for larger features. Accepted ways to speed up review times for your patches are:

  • Review other people’s patches. If you help out, everybody will be more willing to do the same for you; goodwill is our currency.

  • Ping the patch. If it is urgent, provide reasons why it is important to you to get this patch landed and ping it every couple of days. If it is not urgent, the common courtesy ping rate is one week. Remember that you are asking for valuable time from other professional developers.

  • Ask for help on mailing lists, IRC, etc. Others may be able to either help you directly, or suggest a reviewer.

  • Split your patch into multiple smaller patches that build on each other. The smaller your patch, the higher the probability that somebody will take a quick look at it.

    When making large changes, it is helpful to keep this in mind from the beginning of the effort as breaking large changes into smaller ones is often difficult after the fact.

Developers should participate in code reviews as both reviewers and reviewees. If someone is kind enough to review your code, you should return the favor for someone else. Note that while anyone is welcome to review and give feedback on a patch, only an appropriate subject-matter expert can approve a change. This will usually be a committer who works with the code in question on a regular basis.

In some cases, no subject-matter expert may be available. In those cases, a review by an experienced developer is sufficient when coupled with appropriate testing.

9. Commit Log Messages

This section contains some suggestions and traditions for how commit logs are formatted.

9.1. Why are commit messages important?

When you commit a change in Git, Subversion, or another version control system (VCS), you’re prompted to write some text describing the commit — a commit message. How important is this commit message? Should you spend some significant effort writing it? Does it really matter if you write simply fixed a bug?

Most projects have more than one developer and last for some length of time. Commit messages are a very important method of communicating with other developers, in the present and for the future.

FreeBSD has hundreds of active developers and hundreds of thousands of commits spanning decades of history. Over that time the developer community has learned how valuable good commit messages are; sometimes these are hard-learned lessons.

Commit messages serve at least three purposes:

  • Communicating with other developers

    FreeBSD commits generate email to various mailing lists. These include the commit message along with a copy of the patch itself. Commit messages are also viewed through commands like git log. These serve to make other developers aware of changes that are ongoing; that other developer may want to test the change, may have an interest in the topic and will want to review in more detail, or may have their own projects underway that would benefit from interaction.

  • Making Changes Discoverable

    In a large project with a long history it may be difficult to find changes of interest when investigating an issue or change in behaviour. Verbose, detailed commit messages allow searches for changes that might be relevant. For example, git log --since 1year --grep 'USB timeout'.

  • Providing historical documentation

    Commit messages serve to document changes for future developers, perhaps years or decades later. This future developer may even be you, the original author. A change that seems obvious today may be decidedly not so much later on.

The git blame command annotates each line of a source file with the change (hash and subject line) that brought it in.

Having established the importance, here are elements of a good FreeBSD commit message:

9.2. Start with a subject line

Commit messages should start with a single-line subject that briefly summarizes the change. The subject should, by itself, allow the reader to quickly determine if the change is of interest or not.

9.3. Keep subject lines short

The subject line should be as short as possible while still retaining the required information. This is to make browsing Git log more efficient, and so that git log --oneline can display the short hash and subject on a single 80-column line. A good rule of thumb is to stay below 63 characters, and aim for about 50 or fewer if possible.

9.4. Prefix the subject line with a component, if applicable

If the change relates to a specific component the subject line may be prefixed with that component name and a colon (:).

foo: Add -k option to keep temporary data

Include the prefix in the 63-character limit suggested above, so that git log --oneline avoids wrapping.

9.5. Capitalize the first letter of the subject

Capitalize the first letter of the subject itself. The prefix, if any, is not capitalized unless necessary (e.g., USB: is capitalized).

9.6. Do not end the subject line with punctuation

Do not end with a period or other punctuation. In this regard the subject line is like a newspaper headline.

9.7. Separate the subject and body with a blank line

Separate the body from the subject with a blank line.

Some trivial commits do not require a body, and will have only a subject.

ls: Fix typo in usage text

9.8. Limit messages to 72 columns

git log and git format-patch indent the commit message by four spaces. Wrapping at 72 columns provides a matching margin on the right edge. Limiting messages to 72 characters also keeps the commit message in formatted patches below RFC 2822’s suggested email line length limit of 78 characters. This limit works well with a variety of tools that may render commit messages; line wrapping might be inconsistent with longer line length.

9.9. Use the present tense, imperative mood

This facilitates short subject lines and provides consistency, including with automatically generated commit messages (e.g., as generated by git revert). This is important when reading a list of commit subjects. Think of the subject as finishing the sentence "when applied, this change will …​".

foo: Implement the -k (keep) option
foo: Implemented the -k option
This change implements the -k option in foo
-k option added

9.10. Focus on what and why, not how

Explain what the change accomplishes and why it is being done, rather than how.

Do not assume that the reader is familiar with the issue. Explain the background and motivation for the change. Include benchmark data if you have it.

If there are limitations or incomplete aspects of the change, describe them in the commit message.

9.11. Consider whether parts of the commit message could be code comments instead

Sometimes while writing a commit message you may find yourself writing a sentence or two explaining some tricky or confusing aspect of the change. When this happens consider whether it would be valuable to have that explanation as a comment in the code itself.

9.12. Write commit messages for your future self

While writing the commit message for a change you have all of the context in mind - what prompted the change, alternate approaches that were considered and rejected, limitations of the change, and so on. Imagine yourself revisiting the change a year or two in the future, and write the commit message in a way that would provide that necessary context.

9.13. Commit messages should stand alone

You may include references to mailing list postings, benchmark result web sites, or code review links. However, the commit message should contain all of the relevant information in case these references are no longer available in the future.

Similarly, a commit may refer to a previous commit, for example in the case of a bug fix or revert. In addition to the commit identifier (revision or hash), include the subject line from the referenced commit (or another suitable brief reference). With each VCS migration (from CVS to Subversion to Git) revision identifiers from previous systems may become difficult to follow.

As well as including an informative message with each commit, some additional information may be needed.

This information consists of one or more lines containing the key word or phrase, a colon, tabs for formatting, and then the additional information.

The key words or phrases are:


The problem report (if any) which is affected (typically, by being closed) by this commit. Multiple PRs may be specified on one line, separated by commas or spaces.

Reported by:

The name and e-mail address of the person that reported the issue; for developers, just the username on the FreeBSD cluster. Typically used when there is no PR, for example if the issue was reported on a mailing list.

Submitted by:

This has been deprecated with git; submitted patches should have the author set by using git commit --author with a full name and valid email.

Reviewed by:

The name and e-mail address of the person or people that reviewed the change; for developers, just the username on the FreeBSD cluster. If a patch was submitted to a mailing list for review, and the review was favorable, then just include the list name. If the reviewer is not a member of the project, provide the name, email, and if ports an external role like maintainer:

Reviewed by a developer:

Reviewed by: username

Reviewed by a ports maintainer that is not a developer:

Reviewed by: Full Name <[email protected]> (maintainer)

Tested by:

The name and e-mail address of the person or people that tested the change; for developers, just the username on the FreeBSD cluster.

Approved by:

The name and e-mail address of the person or people that approved the change; for developers, just the username on the FreeBSD cluster.

There are several cases where approval is customary:

  • while a new committer is under mentorship

  • commits to an area of the tree covered by the LOCKS file (src)

  • during a release cycle

  • committing to a repo where you do not hold a commit bit (e.g. src committer committing to docs)

While under mentorship, get mentor approval before the commit. Enter the mentor’s username in this field, and note that they are a mentor:

Approved by: username-of-mentor (mentor)

If a team approved these commits then include the team name followed by the username of the approver in parentheses. For example:

Approved by: re (username)

Obtained from:

The name of the project (if any) from which the code was obtained. Do not use this line for the name of an individual person.


The Git short hash and the title line of a commit that is fixed by this change as returned by git log -n 1 --oneline GIT-COMMIT-HASH.

MFC after:

To receive an e-mail reminder to MFC at a later date, specify the number of days, weeks, or months after which an MFC is planned.

MFC to:

If the commit should be merged to a subset of stable branches, specify the branch names.

MFC with:

If the commit should be merged together with a previous one in a single MFC commit (for example, where this commit corrects a bug in the previous change), specify the corresponding Git hash.


If the commit is to be merged into a ports quarterly branch name, specify the quarterly branch. For example 2021Q2.


If the change is a candidate for inclusion in the release notes for the next release from the branch, set to yes.


If the change is related to a security vulnerability or security exposure, include one or more references or a description of the issue. If possible, include a VuXML URL or a CVE ID.


The description for the event where this commit was made. If this is a recurring event, add the year or even the month to it. For example, this could be FooBSDcon 2019. The idea behind this line is to put recognition to conferences, gatherings, and other types of meetups and to show that these are useful to have. Please do not use the Sponsored by: line for this as that is meant for organizations sponsoring certain features or developers working on them.

Sponsored by:

Sponsoring organizations for this change, if any. Separate multiple organizations with commas. If only a portion of the work was sponsored, or different amounts of sponsorship were provided to different authors, please give appropriate credit in parentheses after each sponsor name. For example, (alice, code refactoring), Wormulon (bob), Momcorp (cindy) shows that Alice was sponsored by to do code refactoring, while Wormulon sponsored Bob’s work and Momcorp sponsored Cindy’s work. Other authors were either not sponsored or chose not to list sponsorship.

Pull Request:

This change was submitted as a pull request or merge request against one of FreeBSD’s public read-only Git repositories. It should include the entire URL to the pull request, as these often act as code reviews for the code. For example:


ID certifies compliance with

Differential Revision:

The full URL of the Phabricator review. This line must be the last line. For example:

Example 4. Commit Log for a Commit Based on a PR

The commit is based on a patch from a PR submitted by John Smith. The commit message "PR" field is filled.


PR:		12345

The committer sets the author of the patch with git commit --author "John Smith <[email protected]>".

Example 5. Commit Log for a Commit Needing Review

The virtual memory system is being changed. After posting patches to the appropriate mailing list (in this case, freebsd-arch) and the changes have been approved.


Reviewed by:	-arch
Example 6. Commit Log for a Commit Needing Approval

Commit a port, after working with the listed MAINTAINER, who said to go ahead and commit.


Approved by:	abc (maintainer)

Where abc is the account name of the person who approved.

Example 7. Commit Log for a Commit Bringing in Code from OpenBSD

Committing some code based on work done in the OpenBSD project.


Obtained from:	OpenBSD
Example 8. Commit Log for a Change to FreeBSD-CURRENT with a Planned Commit to FreeBSD-STABLE to Follow at a Later Date.

Committing some code which will be merged from FreeBSD-CURRENT into the FreeBSD-STABLE branch after two weeks.


MFC after:	2 weeks

Where 2 is the number of days, weeks, or months after which an MFC is planned. The weeks option may be day, days, week, weeks, month, months.

It is often necessary to combine these.

Consider the situation where a user has submitted a PR containing code from the NetBSD project. Looking at the PR, the developer sees it is not an area of the tree they normally work in, so they have the change reviewed by the arch mailing list. Since the change is complex, the developer opts to MFC after one month to allow adequate testing.

The extra information to include in the commit would look something like

Example 9. Example Combined Commit Log
PR:		54321
Reviewed by:	-arch
Obtained from:	NetBSD
MFC after:	1 month
Relnotes:	yes

10. Preferred License for New Files

The FreeBSD Project’s full license policy can be found at

The FreeBSD project discourages completely new licenses and variations on the standard licenses. New licenses require the approval of the [email protected] to reside in the main repository. The more different licenses that are used in the tree, the more problems that this causes to those wishing to utilize this code, typically from unintended consequences from a poorly worded license.

Project policy dictates that code under some non-BSD licenses must be placed only in specific sections of the repository, and in some cases, compilation must be conditional or even disabled by default. For example, the GENERIC kernel must be compiled under only licenses identical to or substantially similar to the BSD license. GPL, APSL, CDDL, etc, licensed software must not be compiled into GENERIC.

Developers are reminded that in open source, getting "open" right is just as important as getting "source" right, as improper handling of intellectual property has serious consequences. Any questions or concerns should immediately be brought to the attention of the core team.

11. Keeping Track of Licenses Granted to the FreeBSD Project

Various software or data exist in the repositories where the FreeBSD project has been granted a special license to be able to use them. A case in point are the Terminus fonts for use with vt(4). Here the author Dimitar Zhekov has allowed us to use the "Terminus BSD Console" font under a 2-clause BSD license rather than the regular Open Font License he normally uses.

It is clearly sensible to keep a record of any such license grants. To that end, the [email protected] has decided to keep an archive of them. Whenever the FreeBSD project is granted a special license we require the [email protected] to be notified. Any developers involved in arranging such a license grant, please send details to the [email protected] including:

  • Contact details for people or organizations granting the special license.

  • What files, directories etc. in the repositories are covered by the license grant including the revision numbers where any specially licensed material was committed.

  • The date the license comes into effect from. Unless otherwise agreed, this will be the date the license was issued by the authors of the software in question.

  • The license text.

  • A note of any restrictions, limitations or exceptions that apply specifically to FreeBSD’s usage of the licensed material.

  • Any other relevant information.

Once the [email protected] is satisfied that all the necessary details have been gathered and are correct, the secretary will send a PGP-signed acknowledgment of receipt including the license details. This receipt will be persistently archived and serve as our permanent record of the license grant.

The license archive should contain only details of license grants; this is not the place for any discussions around licensing or other subjects. Access to data within the license archive will be available on request to the [email protected].

12. SPDX Tags in the tree

The project uses SPDX tags in our source base. At present, these tags are indented to help automated tools reconstruct license requirements mechanically. All SPDX-License-Identifier tags in the tree should be considered to be informative. All files in the FreeBSD source tree with these tags also have a copy of the license which governs use of that file. In the event of a discrepancy, the verbatim license is controlling. The project tries to follow the SPDX Specification, Version 2.2. How to mark source files and valid algebraic expressions are found in Appendix IV and Appendix V. The project draws identifiers from SPDX’s list of valid short license identifiers. The project uses only the SPDX-License-Identifier tag.

As of March 2021, approximately 25,000 out of 90,000 files in the tree have been marked.

13. Developer Relations

When working directly on your own code or on code which is already well established as your responsibility, then there is probably little need to check with other committers before jumping in with a commit. Working on a bug in an area of the system which is clearly orphaned (and there are a few such areas, to our shame), the same applies. When modifying parts of the system which are maintained, formally, or informally, consider asking for review just as a developer would have before becoming a committer. For ports, contact the listed MAINTAINER in the Makefile.

To determine if an area of the tree is maintained, check the MAINTAINERS file at the root of the tree. If nobody is listed, scan the revision history to see who has committed changes in the past. An example script that lists each person who has committed to a given file along with the number of commits each person has made can be found at on freefall at ~eadler/bin/whodid. If queries go unanswered or the committer otherwise indicates a lack of interest in the area affected, go ahead and commit it.

Avoid sending private emails to maintainers. Other people might be interested in the conversation, not just the final output.

If there is any doubt about a commit for any reason at all, have it reviewed before committing. Better to have it flamed then and there rather than when it is part of the repository. If a commit does results in controversy erupting, it may be advisable to consider backing the change out again until the matter is settled. Remember, with a version control system we can always change it back.

Do not impugn the intentions of others. If they see a different solution to a problem, or even a different problem, it is probably not because they are stupid, because they have questionable parentage, or because they are trying to destroy hard work, personal image, or FreeBSD, but basically because they have a different outlook on the world. Different is good.

Disagree honestly. Argue your position from its merits, be honest about any shortcomings it may have, and be open to seeing their solution, or even their vision of the problem, with an open mind.

Accept correction. We are all fallible. When you have made a mistake, apologize and get on with life. Do not beat up yourself, and certainly do not beat up others for your mistake. Do not waste time on embarrassment or recrimination, just fix the problem and move on.

Ask for help. Seek out (and give) peer reviews. One of the ways open source software is supposed to excel is in the number of eyeballs applied to it; this does not apply if nobody will review code.

14. If in Doubt…​

When unsure about something, whether it be a technical issue or a project convention be sure to ask. If you stay silent you will never make progress.

If it relates to a technical issue ask on the public mailing lists. Avoid the temptation to email the individual person that knows the answer. This way everyone will be able to learn from the question and the answer.

For project specific or administrative questions ask, in order:

  • Your mentor or former mentor.

  • An experienced committer on IRC, email, etc.

  • Any team with a "hat", as they can give you a definitive answer.

  • If still not sure, ask on FreeBSD developers mailing list.

Once your question is answered, if no one pointed you to documentation that spelled out the answer to your question, document it, as others will have the same question.

15. Bugzilla

The FreeBSD Project utilizes Bugzilla for tracking bugs and change requests. Be sure that if you commit a fix or suggestion found in the PR database to close it. It is also considered nice if you take time to close any PRs associated with your commits, if appropriate.

Committers with Bugzilla accounts can have the old account merged with the account by following these steps:

  1. Log in using your old account.

  2. Open new bug. Choose Services as the Product, and Bug Tracker as the Component. In bug description list accounts you wish to be merged.

  3. Log in using account and post comment to newly opened bug to confirm ownership. See Kerberos and LDAP web Password for FreeBSD Cluster for more details on how to generate or set a password for your account.

  4. If there are more than two accounts to merge, post comments from each of them.

You can find out more about Bugzilla at:

17. Who’s Who

Besides the repository meisters, there are other FreeBSD project members and teams whom you will probably get to know in your role as a committer. Briefly, and by no means all-inclusively, these are:

Documentation Engineering Team <[email protected]>

doceng is the group responsible for the documentation build infrastructure, approving new documentation committers, and ensuring that the FreeBSD website and documentation on the FTP site is up to date with respect to the Subversion tree. It is not a conflict resolution body. The vast majority of documentation related discussion takes place on the . More details regarding the doceng team can be found in its Documentation Project Primer.

Glen Barber <[email protected]>, Konstantin Belousov <[email protected]>, Marc Fonvieille <[email protected]>, Xin Li <[email protected]>, Colin Percival <[email protected]>

These are the members of the Release Engineering Team <[email protected]>. This team is responsible for setting release deadlines and controlling the release process. During code freezes, the release engineers have final authority on all changes to the system for whichever branch is pending release status. If there is something you want merged from FreeBSD-CURRENT to FreeBSD-STABLE (whatever values those may have at any given time), these are the people to talk to about it.

Gordon Tetlow <[email protected]>

Gordon Tetlow is the and oversees the Security Officer Team <[email protected]>.

FreeBSD committer’s mailing list

, and are the mailing lists that the version control system uses to send commit messages to. Never send email directly to these lists. Only send replies to this list when they are short and are directly related to a commit.

FreeBSD developers mailing list

All committers are subscribed to -developers. This list was created to be a forum for the committers "community" issues. Examples are Core voting, announcements, etc.

18. SSH Quick-Start Guide

  1. If you do not wish to type your password in every time you use ssh(1), and you use keys to authenticate, ssh-agent(1) is there for your convenience. If you want to use ssh-agent(1), make sure that you run it before running other applications. X users, for example, usually do this from their .xsession or .xinitrc. See ssh-agent(1) for details.

  2. Generate a key pair using ssh-keygen(1). The key pair will wind up in your $HOME/.ssh/ directory.

    Only ECDSA, Ed25519 or RSA keys are supported.

  3. Send your public key ($HOME/.ssh/, $HOME/.ssh/, or $HOME/.ssh/ to the person setting you up as a committer so it can be put into yourlogin in /etc/ssh-keys/ on freefall.

Now ssh-add(1) can be used for authentication once per session. It prompts for the private key’s pass phrase, and then stores it in the authentication agent (ssh-agent(1)). Use ssh-add -d to remove keys stored in the agent.

Test with a simple remote command: ssh ls /usr.

For more information, see ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), and scp(1).

For information on adding, changing, or removing ssh(1) keys, see .

20. The FreeBSD Committers' Big List of Rules

As noted, breaking some of these rules can be grounds for suspension or, upon repeated offense, permanent removal of commit privileges. Individual members of core have the power to temporarily suspend commit privileges until core as a whole has the chance to review the issue. In case of an "emergency" (a committer doing damage to the repository), a temporary suspension may also be done by the repository meisters. Only a 2/3 majority of core has the authority to suspend commit privileges for longer than a week or to remove them permanently. This rule does not exist to set core up as a bunch of cruel dictators who can dispose of committers as casually as empty soda cans, but to give the project a kind of safety fuse. If someone is out of control, it is important to be able to deal with this immediately rather than be paralyzed by debate. In all cases, a committer whose privileges are suspended or revoked is entitled to a "hearing" by core, the total duration of the suspension being determined at that time. A committer whose privileges are suspended may also request a review of the decision after 30 days and every 30 days thereafter (unless the total suspension period is less than 30 days). A committer whose privileges have been revoked entirely may request a review after a period of 6 months has elapsed. This review policy is strictly informal and, in all cases, core reserves the right to either act on or disregard requests for review if they feel their original decision to be the right one.

20.1. Details

  1. Respect other committers.

  2. Respect other contributors.

  3. Discuss any significant change before committing.

    The repository is not where changes are initially submitted for correctness or argued over, that happens first in the mailing lists or by use of the Phabricator service. The commit will only happen once something resembling consensus has been reached. This does not mean that permission is required before correcting every obvious syntax error or manual page misspelling, just that it is good to develop a feel for when a proposed change is not quite such a no-brainer and requires some feedback first. People really do not mind sweeping changes if the result is something clearly better than what they had before, they just do not like being surprised by those changes. The very best way of making sure that things are on the right track is to have code reviewed by one or more other committers.

    When in doubt, ask for review!

  4. Respect existing maintainers if listed.

    Many parts of FreeBSD are not "owned" in the sense that any specific individual will jump up and yell if you commit a change to "their" area, but it still pays to check first. One convention we use is to put a maintainer line in the Makefile for any package or subtree which is being actively maintained by one or more people; see Source Tree Guidelines and Policies for documentation on this. Where sections of code have several maintainers, commits to affected areas by one maintainer need to be reviewed by at least one other maintainer. In cases where the "maintainer-ship" of something is not clear, look at the repository logs for the files in question and see if someone has been working recently or predominantly in that area.

  5. Any disputed change must be backed out pending resolution of the dispute if requested by a maintainer. Security related changes may override a maintainer’s wishes at the Security Officer’s discretion.

    This may be hard to swallow in times of conflict (when each side is convinced that they are in the right, of course) but a version control system makes it unnecessary to have an ongoing dispute raging when it is far easier to simply reverse the disputed change, get everyone calmed down again and then try to figure out what is the best way to proceed. If the change turns out to be the best thing after all, it can be easily brought back. If it turns out not to be, then the users did not have to live with the bogus change in the tree while everyone was busily debating its merits. People very rarely call for back-outs in the repository since discussion generally exposes bad or controversial changes before the commit even happens, but on such rare occasions the back-out should be done without argument so that we can get immediately on to the topic of figuring out whether it was bogus or not.

  6. Changes go to FreeBSD-CURRENT before FreeBSD-STABLE unless specifically permitted by the release engineer or unless they are not applicable to FreeBSD-CURRENT. Any non-trivial or non-urgent change which is applicable should also be allowed to sit in FreeBSD-CURRENT for at least 3 days before merging so that it can be given sufficient testing. The release engineer has the same authority over the FreeBSD-STABLE branch as outlined in rule #5.

    This is another "do not argue about it" issue since it is the release engineer who is ultimately responsible (and gets beaten up) if a change turns out to be bad. Please respect this and give the release engineer your full cooperation when it comes to the FreeBSD-STABLE branch. The management of FreeBSD-STABLE may frequently seem to be overly conservative to the casual observer, but also bear in mind the fact that conservatism is supposed to be the hallmark of FreeBSD-STABLE and different rules apply there than in FreeBSD-CURRENT. There is also really no point in having FreeBSD-CURRENT be a testing ground if changes are merged over to FreeBSD-STABLE immediately. Changes need a chance to be tested by the FreeBSD-CURRENT developers, so allow some time to elapse before merging unless the FreeBSD-STABLE fix is critical, time sensitive or so obvious as to make further testing unnecessary (spelling fixes to manual pages, obvious bug/typo fixes, etc.) In other words, apply common sense.

    Changes to the security branches (for example, releng/9.3) must be approved by a member of the Security Officer Team <[email protected]>, or in some cases, by a member of the Release Engineering Team <[email protected]>.

  7. Do not fight in public with other committers; it looks bad.

    This project has a public image to uphold and that image is very important to all of us, especially if we are to continue to attract new members. There will be occasions when, despite everyone’s very best attempts at self-control, tempers are lost and angry words are exchanged. The best thing that can be done in such cases is to minimize the effects of this until everyone has cooled back down. Do not air angry words in public and do not forward private correspondence or other private communications to public mailing lists, mail aliases, instant messaging channels or social media sites. What people say one-to-one is often much less sugar-coated than what they would say in public, and such communications therefore have no place there - they only serve to inflame an already bad situation. If the person sending a flame-o-gram at least had the grace to send it privately, then have the grace to keep it private yourself. If you feel you are being unfairly treated by another developer, and it is causing you anguish, bring the matter up with core rather than taking it public. Core will do its best to play peace makers and get things back to sanity. In cases where the dispute involves a change to the codebase and the participants do not appear to be reaching an amicable agreement, core may appoint a mutually-agreeable third party to resolve the dispute. All parties involved must then agree to be bound by the decision reached by this third party.

  8. Respect all code freezes and read the committers and developers mailing list on a timely basis so you know when a code freeze is in effect.

    Committing unapproved changes during a code freeze is a really big mistake and committers are expected to keep up-to-date on what is going on before jumping in after a long absence and committing 10 megabytes worth of accumulated stuff. People who abuse this on a regular basis will have their commit privileges suspended until they get back from the FreeBSD Happy Reeducation Camp we run in Greenland.

  9. When in doubt on any procedure, ask first!

    Many mistakes are made because someone is in a hurry and just assumes they know the right way of doing something. If you have not done it before, chances are good that you do not actually know the way we do things and really need to ask first or you are going to completely embarrass yourself in public. There is no shame in asking "how in the heck do I do this?" We already know you are an intelligent person; otherwise, you would not be a committer.

  10. Test your changes before committing them.

    This may sound obvious, but if it really were so obvious then we probably would not see so many cases of people clearly not doing this. If your changes are to the kernel, make sure you can still compile both GENERIC and LINT. If your changes are anywhere else, make sure you can still make world. If your changes are to a branch, make sure your testing occurs with a machine which is running that code. If you have a change which also may break another architecture, be sure and test on all supported architectures. Please refer to the for a list of available resources. As other architectures are added to the FreeBSD supported platforms list, the appropriate shared testing resources will be made available.

  11. Do not commit to contributed software without explicit approval from the respective maintainers.

20.5. Privacy and Confidentiality

  1. Most FreeBSD business is done in public.

  2. Certain sensitive matters must remain private or held under embargo.

  3. The Security Officer has sole control over the release of security advisories.

  4. Communications with Core are kept confidential for as long as necessary.

  5. Non-disclosure Agreements may be required for access to certain commercially sensitive data.

  6. Private communications must not be made public without permission.

  7. Communications on project-only or restricted access channels must be kept private.

  8. Core may approve publication.

21. Support for Multiple Architectures

21.2. Platform Targets

21.3. Tier 1: Fully-Supported Architectures

21.4. Tier 2: Developmental and Niche Architectures

22. Ports Specific FAQ

22.1. Adding a New Port

22.1.1. How do I add a new port?

Adding a port to the tree is relatively simple. Once the port is ready to be added, as explained later here, you need to add the port’s directory entry in the category’s Makefile. In this Makefile, ports are listed in alphabetical order and added to the SUBDIR variable, like this:

	SUBDIR += newport

Once the port and its category’s Makefile are ready, the new port can be committed:

% git add category/Makefile category/newport
% git commit
% git push

Don’t forget to setup git hooks for the ports tree as explained here; a specific hook has been developed to verify the category’s Makefile.

22.1.2. Any other things I need to know when I add a new port?

Check the port, preferably to make sure it compiles and packages correctly.

The Porters Handbook’s Testing Chapter contains more detailed instructions. See the Portclippy / Portfmt and the Poudriere sections.

You do not necessarily have to eliminate all warnings but make sure you have fixed the simple ones.

If the port came from a submitter who has not contributed to the Project before, add that person’s name to the Additional Contributors section of the FreeBSD Contributors List.

Close the PR if the port came in as a PR. To close a PR, change the state to Issue Resolved and the resolution as Fixed.

If for some reason using Poudriere to test the new port is not possible, the bare minimum of testing includes this sequence:

# make install
# make package
# make deinstall
# pkg add package you built above
# make deinstall
# make reinstall
# make package

Note that poudriere is the reference for package building, it the port does not build in poudriere, it will be removed.

22.2. Removing an Existing Port

22.2.1. How do I remove an existing port?

First, please read the section about repository copies. Before you remove the port, you have to verify there are no other ports depending on it.

  • Make sure there is no dependency on the port in the ports collection:

    • The port’s PKGNAME appears in exactly one line in a recent INDEX file.

    • No other ports contains any reference to the port’s directory or PKGNAME in their Makefiles

      When using Git, consider using git-grep(1), it is much faster than grep -r.

  • Then, remove the port:

    • Remove the port’s files and directory with git rm.

    • Remove the SUBDIR listing of the port in the parent directory Makefile.

    • Add an entry to ports/MOVED.

    • Remove the port from ports/LEGAL if it is there.

Alternatively, you can use the rmport script, from ports/Tools/scripts. This script was written by Vasil Dimov <[email protected]>. When sending questions about this script to the , please also CC Chris Rees <[email protected]>, the current maintainer.

22.3. How do I move a port to a new location?

  1. Perform a thorough check of the ports collection for any dependencies on the old port location/name, and update them. Running grep on INDEX is not enough because some ports have dependencies enabled by compile-time options. A full git-grep(1) of the ports collection is recommended.

  2. Remove the SUBDIR entry from the old category Makefile and add a SUBDIR entry to the new category Makefile.

  3. Add an entry to ports/MOVED.

  4. Search for entries in xml files inside ports/security/vuxml and adjust them accordingly. In particular, check for previous packages with the new name which version could include the new port.

  5. Move the port with git mv.

  6. Commit the changes.

22.4. How do I copy a port to a new location?

  1. Copy port with cp -R old-cat/old-port new-cat/new-port.

  2. Add the new port to the new-cat/Makefile.

  3. Change stuff in new-cat/new-port.

  4. Commit the changes.

22.5. Ports Freeze

22.5.1. What is a “ports freeze”?

A “ports freeze” was a restricted state the ports tree was put in before a release. It was used to ensure a higher quality for the packages shipped with a release. It usually lasted a couple of weeks. During that time, build problems were fixed, and the release packages were built. This practice is no longer used, as the packages for the releases are built from the current stable, quarterly branch.

For more information on how to merge commits to the quarterly branch, see What is the procedure to request authorization for merging a commit to the quarterly branch?.

22.6. Quarterly Branches

22.6.1. What is the procedure to request authorization for merging a commit to the quarterly branch?

As of November 30, 2020, there is no need to seek explicit approval to commit to the quarterly branch.

22.6.2. What is the procedure for merging commits to the quarterly branch?

Merging commits to the quarterly branch (a process we call MFH for a historical reason) is very similar to MFC’ing a commit in the src repository, so basically:

% git checkout 2021Q2
% git cherry-pick -x $HASH
(verify everything is OK, for example by doing a build test)
% git push

where '$HASH' is the hash of the commit you want to copy over to the quarterly branch. The -x parameter ensures the hash '$HASH' of the main branch is included in the new commit message of the quarterly branch.

22.7. Creating a New Category

22.7.1. What is the procedure for creating a new category?

Please see Proposing a New Category in the Porter’s Handbook. Once that procedure has been followed and the PR has been assigned to the Ports Management Team <[email protected]>, it is their decision whether or not to approve it. If they do, it is their responsibility to:

  1. Perform any needed moves. (This only applies to physical categories.)

  2. Update the VALID_CATEGORIES definition in ports/Mk/

  3. Assign the PR back to you.

22.7.2. What do I need to do to implement a new physical category?

  1. Upgrade each moved port’s Makefile. Do not connect the new category to the build yet.

    To do this, you will need to:

    1. Change the port’s CATEGORIES (this was the point of the exercise, remember?) The new category is listed first. This will help to ensure that the PKGORIGIN is correct.

    2. Run a make describe. Since the top-level make index that you will be running in a few steps is an iteration of make describe over the entire ports hierarchy, catching any errors here will save you having to re-run that step later on.

    3. If you want to be really thorough, now might be a good time to run portlint(1).

  2. Check that the PKGORIGINs are correct. The ports system uses each port’s CATEGORIES entry to create its PKGORIGIN, which is used to connect installed packages to the port directory they were built from. If this entry is wrong, common port tools like pkg-version(8) and portupgrade(1) fail.

    To do this, use the tool: env PORTSDIR=/path/to/ports sh -e /path/to/ports/Tools/scripts/ This will check every port in the ports tree, even those not connected to the build, so you can run it directly after the move operation. Hint: do not forget to look at the PKGORIGINs of any slave ports of the ports you just moved!

  3. On your own local system, test the proposed changes: first, comment out the SUBDIR entries in the old ports' categories' Makefiles; then enable building the new category in ports/Makefile. Run make checksubdirs in the affected category directories to check the SUBDIR entries. Next, in the ports/ directory, run make index. This can take over 40 minutes on even modern systems; however, it is a necessary step to prevent problems for other people.

  4. Once this is done, you can commit the updated ports/Makefile to connect the new category to the build and also commit the Makefile changes for the old category or categories.

  5. Add appropriate entries to ports/MOVED.

  6. Update the documentation by modifying:

  7. Only once all the above have been done, and no one is any longer reporting problems with the new ports, should the old ports be deleted from their previous locations in the repository.

22.7.3. What do I need to do to implement a new virtual category?

This is much simpler than a physical category. Only a few modifications are needed:

22.8. Miscellaneous Questions

22.8.1. Are there changes that can be committed without asking the maintainer for approval?

Blanket approval for most ports applies to these types of fixes:

  • Most infrastructure changes to a port (that is, modernizing, but not changing the functionality). For example, the blanket covers converting to new USES macros, enabling verbose builds, and switching to new ports system syntaxes.

  • Trivial and tested build and runtime fixes.

  • Documentations or metadata changes to ports, like pkg-descr or COMMENT.

Exceptions to this are anything maintained by the Ports Management Team <[email protected]>, or the Security Officer Team <[email protected]>. No unauthorized commits may ever be made to ports maintained by those groups.

22.8.2. How do I know if my port is building correctly or not?

The packages are built multiple times each week. If a port fails, the maintainer will receive an email from [email protected].

Reports for all the package builds (official, experimental, and non-regression) are aggregated at

22.8.3. I added a new port. Do I need to add it to the INDEX?

No. The file can either be generated by running make index, or a pre-generated version can be downloaded with make fetchindex.

22.8.4. Are there any other files I am not allowed to touch?

Any file directly under ports/, or any file under a subdirectory that starts with an uppercase letter (Mk/, Tools/, etc.). In particular, the Ports Management Team <[email protected]> is very protective of ports/Mk/bsd.port*.mk so do not commit changes to those files unless you want to face their wrath.

22.8.5. What is the proper procedure for updating the checksum for a port distfile when the file changes without a version change?

When the checksum for a distribution file is updated due to the author updating the file without changing the port revision, the commit message includes a summary of the relevant diffs between the original and new distfile to ensure that the distfile has not been corrupted or maliciously altered. If the current version of the port has been in the ports tree for a while, a copy of the old distfile will usually be available on the ftp servers; otherwise the author or maintainer should be contacted to find out why the distfile has changed.

22.8.6. How can an experimental test build of the ports tree (exp-run) be requested?

An exp-run must be completed before patches with a significant ports impact are committed. The patch can be against the ports tree or the base system.

Full package builds will be done with the patches provided by the submitter, and the submitter is required to fix detected problems (fallout) before commit.

  1. Go to the .

  2. Select the product your patch is about.

  3. Fill in the bug report as normal. Remember to attach the patch.

  4. If at the top it says “Show Advanced Fields” click on it. It will now say “Hide Advanced Fields”. Many new fields will be available. If it already says “Hide Advanced Fields”, no need to do anything.

  5. In the “Flags” section, set the “exp-run” one to ?. As for all other fields, hovering the mouse over any field shows more details.

  6. Submit. Wait for the build to run.

  7. Ports Management Team <[email protected]> will reply with a possible fallout.

  8. Depending on the fallout:

    • If there is no fallout, the procedure stops here, and the change can be committed, pending any other approval required.

      1. If there is fallout, it must be fixed, either by fixing the ports directly in the ports tree, or adding to the submitted patch.

      2. When this is done, go back to step 6 saying the fallout was fixed and wait for the exp-run to be run again. Repeat as long as there are broken ports.

23. Issues Specific to Developers Who Are Not Committers

A few people who have access to the FreeBSD machines do not have commit bits. Almost all of this document will apply to these developers as well (except things specific to commits and the mailing list memberships that go with them). In particular, we recommend that you read:

24. Information About Google Analytics

As of December 12, 2012, Google Analytics was enabled on the FreeBSD Project website to collect anonymized usage statistics regarding usage of the site.

As of March 3, 2022, Google Analytics was removed from the FreeBSD Project.

25. Miscellaneous Questions

25.1. How do I access to put up personal or project information? is the same as Just create a public_html directory. Anything you place in that directory will automatically be visible under

25.2. Where are the mailing list archives stored?

26. Benefits and Perks for FreeBSD Committers


Gandi provides website hosting, cloud computing, domain registration, and X.509 certificate services.

Gandi offers an E-rate discount to all FreeBSD developers. In order to streamline the process of getting the discount first set up a Gandi account, fill in the billing information and select the currency. Then send an mail to [email protected] using your mail address, and indicate your Gandi handle.

26.4. provides cloud storage for offsite backup that is optimized for UNIX users. Their service runs entirely on FreeBSD and ZFS. offers a free-forever 500 GB account to FreeBSD developers. Simply sign up at using your address to receive this free account.

Last modified on: June 26, 2022 by Sergio Carlavilla Delgado