Skip to content

mattmc3/dotfiles

Repository files navigation

dotfiles

My dotfiles

Intro

This repo is for storing my public config files, canonically called "dotfiles". Having dotfiles in a repo makes setup on a new machine just a simple git clone away. Some of the techniques and code are based on concepts from this article, this article on bare repos, and the zillions of other dotfile repos on GitHub.

Terminal

Prereqs

  • git

Bare repo

alias dotty='GIT_WORK_TREE=~ GIT_DIR=~/.dotfiles'
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
git clone --bare [email protected]:mattmc3/dotfiles $HOME/.dotfiles
dotfiles checkout
if [[ $? == 0 ]]; then
  echo "Checked out dotfiles.";
else
  echo "Backing up pre-existing dot files.";
  dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles.bak/{}
fi

Edit

IDE=${VISUAL:-${EDITOR:-vim}}
dotty $IDE ~

Git submodules

Run this to make .local always track the main branch.

cd .local
git checkout main
git pull origin main  # Ensure it's up to date
cd ..
git config -f .gitmodules submodule..local.branch main

Adding these configs helps with push/pull on the .local submodule.

git config push.recurseSubmodules on-demand
git config submodule.recurse true

Notes

Certain legacy apps don't properly use .config, so anything that doesn't has a simple wrapper in $HOME that then sources the real files from ~/.config.

Resources

About

Make everywhere feel like `$HOME`

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published