My dotfiles.
There will probably be some more explanation here later.
I got the idea for this setup from Timos dotfiles, who apparently got it from a HackerNews thread.
The basic idea is to version the files in our home directory with git without having a .git
folder in our home directory (which can be very annoying) and goes like this:
git init --bare $HOME/.dotfiles
alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
dotfiles config --local status.showUntrackedFiles no
It took me a moment to wrap my head around this, so for future me I'll write down a short documentation of whats happening above.
git init --bare $HOME/.dotfiles
Creates a newbare
git repository in our home folder called.dotfiles
. A bare repository does not contain any working or checked out copies of files (further reading here).alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
creates an alias for our newly created bare repository calleddotfiles
. We can use all git commands (likeadd
,commit
,push
) with it, then being i.e.dotfiles add .myfile
. Also, we're defining the.git
directory (~/.dotfiles
) and our working tree (our home folder) here.dotfiles config --local status.showUntrackedFiles no
Hides untracked files when usingdotfiles status
, since the majority of the files in our home directory will most certainly never be tracked in our dotfiles repository.echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.zshrc
Adds the alias to our shell config, which is optional
Further reading can be found here.
All the dotfiles stay in our home directory. If we want to track a file, we simply check it in with our dotfiles
alias like so:
~ $ dotfiles add .gitconfig
And then commit and push the same way.
It's just a Git Repo. But you can't clone into a directory with existing files, like macOS will write some files into the home directory.
-
Clone into a directory with a seperate git directory and a temporary directory as working tree.
git clone --separate-git-dir=$HOME/.dotfiles git@github.com:Plsr/dotfiles.git $HOME/dotfiles-tmp
-
Copy the working tree from the tmp directory into the home directory.
cp -r ~/dotfiles-tmp/. ~
-
Delete the tmp dotfiles directory.
rm -rf ~/dotfiles-tmp/
-
Add the dotfiles-git alias to the current shell.
alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
-
Don't show untracked files.
dotfiles config --local status.showUntrackedFiles no
- Get basics working
- sign in to iCloud
- basic setup of Mouse & Keyboard
- Install Homebrew
- Intall git (will be re-installed via the Brewfile in step 6)
- Set up SSH key for Github
- Clone dotfiles
brew bundle
- Change Alfred Shortcuts to CMD + Space
- Setup Dropbox and 1Password, then sign in to all the apps
- You're all set up
Plugins are installed via Vundle, so there is little to worry about. However, it
might happen that Vundle is not working out of the box. Reinstalling will solve
that issue. Afterwards, just run :PluginInstall
in vim and you're cooking with
gas.