Skip to content

Dotfiles

Overview

Dotfile managers

git bare repository

Initialize:

git init --bare $HOME/.dotfiles
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.sh_aliases
. ./.sh_aliases
dotfiles config --local status.showUntrackedFiles no
dotfiles config --local user.name Varac
dotfiles config --local user.email varac@varac.net
dotfiles remote add origin git@0xacab.org:varac-projects/dotfiles.git

Usage:

dotfiles add ~/.config/sway
dotfiles status
dotfiles commit -m'Initial commit'
dotfiles push --set-upstream origin main

Pull to another device:

First, add an ssh key of the new device to 0xacab profile: keys Then:

git clone --bare git@0xacab.org:varac-projects/dotfiles.git $HOME/.dotfiles
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.sh_aliases
dotfiles checkout
dotfiles config --local status.showUntrackedFiles no

Fetch all remote branches:

Somehow, dotfiles fetch doesn't fetch any other remote branches, but this will do:

dotfiles fetch  origin '*:*'

Manage dotfiles with plain git repo

Manage dotfiles with Ansible

Other tools

Stale:

Example dotfile config repos

pre-commit

Solution:

alias dotfiles="GIT_DIR=/home/varac/.dotfiles/ GIT_WORK_TREE=/home/varac"
dotfiles pre-commit install
dotfiles pre-commit run --all