freebsd and git

FreeBSD just migrated to git, and while handbook is being updated, you can do the migration yourself.

first of all, move original src directory (if you’re synchronizing over SVN) away, along with customized kernel config file. for my deployments I do:

mv /usr/src /usr/src.old

then, let’s install git - it’s not (yet) installed by default:

pkg install git

last, but not least, you need to invoke git to clone the source repository. I prefer to track latest -STABLE version of the tree, and in such case you should execute:

git clone -b stable/12 --depth 1 https://git.freebsd.org/src.git /usr/src

Cloning into '/usr/src'...
remote: Enumerating objects: 84805, done.
remote: Counting objects: 100% (84805/84805), done.
remote: Compressing objects: 100% (73792/73792), done.
remote: Total 84805 (delta 17810), reused 41814 (delta 7917), pack-reused 0
Receiving objects: 100% (84805/84805), 275.33 MiB | 10.08 MiB/s, done.
Resolving deltas: 100% (17810/17810), done.
Updating files: 100% (81378/81378), done.

if you want to track -CURRENT for some reason, the command would be:

git clone https://git.freebsd.org/src.git /usr/src

your uname -a output will change from SVN commit tag:

FreeBSD ns 12.2-STABLE FreeBSD 12.2-STABLE r368820 server amd64

to git commit id:

FreeBSD ns 12.2-STABLE stable/12-c4-g45b2c3bec server