This really is the simplest way to manage dotfiles.
All you really need is for git to be installed on the local system.
-
This method is is derived from this thread on Hacker News.
-
Atlassian has a great write-up using the information from the thread.
-
The Arch Linux Wiki also has a section regarding dotfiles.
What you will learn here is not much different than what is provided in the above threads. The key differences being the fact that I chose to name my alias "figgit" because "config" never struck me as an appropriate name. Also, I named my dotfile bare git repo directory ".dotfiles" because it just makes the most sense.
Note: This guide assumes you're using zsh as your shell and have git installed.
# dotfile (config) git repo - "figgit"
zstyle ':completion:*:*:git:*' user-commands figgit:'figgit dotfile git alias'
alias figgit='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
(( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir]
(( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(e)~opt_args[--git-dir]}
(( $+opt_args[--work-tree] )) && local -x GIT_WORKTREE=${(e)~opt_args[--work-tree]}
git init --bare $HOME/.dotfiles
figgit config --local status.showUntrackedFiles no
figgit add .zshrc.local
figgit commit -m "~/.zshrc.local"
# remember to use your <tab> completion here :)
figgit add ~/.config/nvim/init.vim
figgit commit -m "init.vim"
figgit push