This solution for storing dotfiles is inspired by this comment on Hacker News!
You MUST complete these few steps before attempting to follow any of the instructions below. To initialize your machine:
-
Add a
dotfile
alias. The.bashrc
and.zshrc
in this repo already contain the configuration, but if you don't have the configurations pulled from here, you'll have to set it yourself.For bash
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.bashrc
For zsh
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.zshrc
For current scope
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
-
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install brew bundle
brew tap Homebrew/bundle
- Clone this repo
git clone --bare https://github.com/O-Hannonen/dotfiles.git $HOME/.dotfiles
- Checkout the content
dotfiles checkout
- Install contents of Brefile
brew bundle install
- Use basic git commands to commit changes
dotfiles add .zshrc dotfiles commit -m "feat: updates .zshrc" dotfiles push
- That's it!
- Initialize git repo
git init --bare $HOME/.dotfiles
- Hide untracked files
dotfiles config --local status.showUntrackedFiles no
- Create Brewfile which contains everything you've installed with homebrew
brew bundle dump -f
- Use basic git commands to add remote commit changes. You should add all the files here you want to include in your dotfiles (also the newly created Brewfile)
dotfiles remote add origin [email protected]:<USERNAME>/dotfiles.git dotfiles commit -m "feat: initial commit" dotfiles push -u origin main