SDF allows setting up your dotfiles as simple as:
$ sdf clone <URL to your repository>
$ sdf checkout master
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.
SDF is compiled with Go compiler. It uses Git internally and optionally depends on strace for tracing (see below).
$ go build -o sdf main.go # compile
$ mv sdf /usr/bin/sdf # or use directly
Create an empty repository on any Git hosting service. Let's assume your repository URL is https://example.com/username/profile.git
.
- 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
Here, master
is the branch that you're pushing to.
- Rinse & Repeat
$ sdf add ~/.zshrc
$ sdf commit -m "Move to Zsh"
$ sdf push
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!
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.
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.
- Shreyansh Khajanchi <shreyansh_k@live.com>
- SneakyCobra <https://news.ycombinator.com/item?id=11070797>