SDF: Sane DotFiles manager
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
NOTES
README.rst
default.nix
go.mod
go.sum
main.go

README.rst

SDF: Sane DotFiles

SDF allows setting up your dotfiles as simple as:

$ sdf clone <URL to your repository>
$ sdf checkout master

What is SDF?

SDF is a program to help you version control your $HOME directory.

Under the hood it wraps git to make version control of your dotfiles simple and straightforward while also giving you the full flexibility of Git's CLI when you need it. It reimplements a few commands to make them more suitable for handling the task of managing dotfiles and then provides some useful extra commands.

Installing SDF

SDF is compiled with Go compiler. It uses Git internally and optionally depends on strace for tracing (see below).

Build + Install

$ go build -o sdf main.go   # compile
$ mv sdf /usr/bin/sdf       # or use directly

Get started with SDF

Start with a clean $HOME

Create an empty repository on any Git hosting service. Let's assume your repository URL is https://example.com/username/profile.git.

  1. Initialize SDF like this:
$ sdf init https://example.com/username/profile.git
Initialized new configuration.
  1. Your first commit and push:
$ sdf add ~/.bashrc
$ sdf commit -m "Initial commit"
$ sdf push --set-upstream origin master

Here, master is the branch that you're pushing to.

  1. Rinse & Repeat
$ sdf add ~/.zshrc
$ sdf commit -m "Move to Zsh"
$ sdf push

Restore previous $HOME

Assuming your repository URL is https://example.com/username/profile.git and you need the master branch.

$ sdf clone https://example.com/username/profile.git
$ sdf checkout master

That's really it!

Advanced usage

Tracing

At times, you don't know (or remember) which configuration files in your $HOME are being read by a program but you want to version control them.

Presenting "sdf trace" to your disposal. SDF with the help of venerable strace will help you version control configuration for the awesome music library manager beets as an example.

$ sdf trace beet
.config/beets/config.yaml

You now know that $HOME/.config/beets/config.yaml is the file you need.

Git CLI

Because SDF is a wrapper around Git, you can pass all valid git commands (except clone & init) like:

$ sdf checkout -b dev   # switch branch
$ sdf log               # view changelog
$ sdf diff @~..@        # view diff of last commit

See Git's documentation for more details.

Credits