Setting up Git on FreeBSD

In this tutorial, I explain how to set up Git on FreeBSD and show you some useful Git tools.

What is Git

Git is a free and open source distributed version control system designed to manage everything from small to large projects quickly and efficiently.

We can install Git as follows:

shell: doas pkg install git 

In order for Git to know which user we are, we also run the following commands.

shell: git config --global ""
shell: git config --global "Your Name".

Create SSH Keys

If we have private repositories on GitHub and we want to check it out on our PC, we need an SSH key.

We can easily create an SSH key with the following command:

shell: ssh-keygen -t ed25519 -C ""

Then we can output the newly created public key with the following command:

shell: tail .ssh/

We copy the output and can now enter the public key in the user settings in GitHub.

What is Git-Flow

Git-Flow by Vincent Driessen is a branching and version management workflow in Git that helps developers keep track of features, hot-fixes, and versions in larger software projects. This workflow involves many commands to type and remember. The git-flow library of git subcommands can help by automating some parts of the workflow to make it easier to work with.

We can install git-flow as follows:

shell: doas pkg install gitflow

After installing git-flow, we use the git flow init command to use git-flow in a repository. To create a new repository, run git flow init in an empty directory:

shell: git flow init

Initialized empty Git repository in ~/project/.git/
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop].

How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []

Now we could use the commands from here, but I want to show you a simplification. If you followed my ZSH instructions, we can add the following to our ZSH configuration file:

shell: nano .zshrc ⇒

gffs() {
    git flow feature start $1

gfff() {
    git flow feature finish $1 && git push

gfrs() {
    git flow release start $1

gfrf() {
    git flow release finish $1 && git push --tags && git checkout master && git push && git checkout develop && git push

gfhs() {
    git flow hotfix start $1

gfhf() {
    git flow hotfix finish $1 && git push --tags && git checkout master && git push && git checkout develop && git push

Now I'll explain what each command does.


With gffs we can start a new feature.


gffs feat/feature_name


When we have finished developing a feature, we can use the gfff command to end the feature.

gfff feat/feature_name

Now what does it do exactly, we tell Git Flow that we have finished this feature. Then it will be merged into the developer branch and then it will automatically push it into Git.


After some time, when we have developed enough features, we can start a new release with the gfrs command.

gfrs v1.0.0

Git-Flow now creates a release branch with the tag v1.0.0. We can now either create the release notes or add other short term fixes.


When we are satisfied with the release branch, we can finalize the release with the gfrf command.

gfrf v1.0.0

Git flow now finalizes the release branch, pushes the release tag with the appropriate release number into git, then pushes everything into the master and develop branch.


As with any development, it can happen that bugs occur on the master system, where a hotfix then needs to be pushed out. We can then do the whole thing with the gfhs command.

gfhs v1.0.1

With this command a new branch of Master is created. And we can then prepare the hotfix.


After the hotfix is ready. We use the command gfhf.

gfhf v1.0.1

When we run this command, the hotfix will be pushed to master first and also automatically pushed back to the develop branch.

Git Tools

In this section I would like to introduce useful Git related programs. They can be very helpful.


git-delta is a syntax highlighting pager for git, diff and grep output.

We can install git-delta as follows:

shell: doas pkg install git-delta

Next, we can create the following configuration file.

shell: nano ~/.gitconfig ⇒

    pager = delta

    diffFilter = delta --color-only

    navigate = true

    conflictstyle = diff3

    colorMoved = default


git-bug is an offline-first bug tracker embedded in Git that:

  • is fully embedded in Git: we only need our Git repository to have a bug tracker.
  • is distributable: uses our normal Git remote to collaborate and push and pull our bugs!
  • Works offline: on a plane or at sea? We can just keep reading and writing our bugs!
  • prevents vendor lock-in: our usual service is down? We already have a local full backup.
  • is fast: listing or opening bugs is a matter of milliseconds. No files added to our project.
  • Integrates with our tools: We use the UI we like (CLI, Terminal, Web) or we integrate it with our existing tools via the CLI or GraphQL API.
  • Interfaces with other bug trackers: use interfaces to import and export to other trackers.

We can install it as follows:

shell: doas pkg install git-bug

First we change to a git repository directory where we want to use git-bug, then first we have to use the command:

shell: git bug user create


Thereafter, we can either use the CLI, the interactive terminal or the web UI.

If we use the CLI, I recommend you to have a look at the command list here.

We open the interactive terminal UI with

shell: git bug termui

or with the command:

shell: git bug webui

we can open a web UI based on the React framework and looks like this.

There is also an interface connection to the bug trackers GitHub, GitLab and Jira.
For this, we run the command:

git bug bridge configure

and we are interactively guided through the configuration.

Interested to see how git-bug works? Have a look at the data model and the internal architecture.


Another helpful GIT package is the git-extras collection. It includes commands such as repo summary, repl, changelog population, percentage of author commits, and more, among others.

We can install git-extras like this:

shell: doas pkg install git-extras

Let me show you 2 examples of what the package includes.

We can output the contributions of an author to a project, let's run the following:

shell: git contrib visionmedia ⇒ 

visionmedia (18):
  Replaced several calls with
  Moved help msg to node-repl
  Added multiple arg support for sys.puts(), print(), etc.
  Fix stack output on socket error

Or we can also print a summary of the repo:

shell: git summary ⇒ 

project : git-extras
repo age : 10 months ago
commits : 163
active : 60 days
files : 93
authors :
   97 Tj Holowaychuk 59.5%
   37 Jonhnny Weslley 22.7%
    8 Kenneth Reitz 4.9%
    5 Aggelos Orfanakos 3.1%
    3 Jonathan "Duke" Leto 1.8%
    2 Gert Van Gool 1.2%
    2 Domenico Rotiroti 1.2%
    2 Devin Withers 1.2%
    2 TJ Holowaychuk 1.2%
    1 Nick Campbell 0.6%
    1 Alex McHale 0.6%
    1 Jason Young 0.6%
    1 Jens K. Mueller 0.6%
    1 Guillermo Rauch 0.6%

More useful commands can be found here.


Next, I would like to introduce you git-chglog. It is a changelog generator implemented in Go.

It offers the following features:

  • It works with a single binary file. Therefore, any project (environment) can be used.
  • The CLI usage is simple and has a low learning cost
  • For example, the simplest command is git-chglog.

We can install it as follows

shell: doas pkg install git-chglog

In the next step, we can switch to a git repository. And run once the command

shell: git-chglog --init

This command will then interactively create a configuration file and a changelog template.

We can now create a changelog file with the following command:

shell: git-chglog -o


gitg is a graphical user interface for Git. It is a small, fast and handy tool to visualize the history of Git repositories. Besides visualization, gitg also provides various utilities to manage our repository and commit our work.

We can easily install it with

shell: doas pkg install gitg