Welcome reader! These are my dotfiles. Feel free to read/copy them as you wish!
Setup a bare git repository in your home directory. Bare repositories have no
working directory, so setup an alias to avoid typing the long command. Add the
git directory ~/.dotfiles/
to the gitignore as a security measure. Setup
remote and push. Hide untracked files when querying the status.
git init --bare "$HOME/.dotfiles"
echo 'alias dotfiles="/usr/bin/env git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME"' \
>> "$HOME/.zshrc"
source "$HOME/.zshrc"
echo '.dotfiles' >> "$HOME/.gitignore"
dotfiles add "$HOME/.gitignore"
dotfiles commit -m 'Git: Add gitignore'
dotfiles remote add origin https://github.com/alfunx/.dotfiles
dotfiles push --set-upstream origin master
dotfiles config --local status.showUntrackedFiles no
Use the default git subcommands to track, update and remove files. You can obviously also use branches and all other features of git.
dotfiles status
dotfiles add .zshrc
dotfiles commit -m 'Zsh: Add zshrc'
dotfiles add .vimrc
dotfiles commit -m 'Vim: Add vimrc'
dotfiles push
To remove a file from the repository while keeping it locally you can use:
dotfiles rm --cached ~/.some_file