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.
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
- Initialize SDF like this:
$ sdf init https://example.com/username/profile.git Initialized new configuration.
- Your first commit and push:
$ sdf add ~/.bashrc $ sdf commit -m "Initial commit" $ sdf push --set-upstream origin master
master is the branch that you're pushing to.
- 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
$ sdf clone https://example.com/username/profile.git $ sdf checkout master
That's really it!
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.
$ sdf trace beet .config/beets/config.yaml
You now know that
$HOME/.config/beets/config.yaml is the file you need.
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.