Reviewed-on: #28
Dotfiles
Dotfiles is a repository to hold my collection of dotfiles. Each directory is it's own module if you will for enabling certain subsets of the dotfiles.
Installation
To install dotfiles first you need to clone the repository. I highly recommend that you clone into your home directory so that you don't need to pass a --target every time we invoke stow.
We can clone the repository with the following command:
git clone https://git.wesirvin.com/wesley/dotfiles.git ~/dotfiles
After cloning that is it. Just change into the directory and you can deploy or un-deploy following the below instructions.
Deploying
From inside of our dotfiles directory we can deploy very easily with the following command:
stow --dotfiles --verbose zsh
If this command succeeds that is it. Stow creates symlinks to the files in this directory for where they need to go. If you already have configuration files in place then the command may fail. If that happens we have a couple of choices. First things first we need to adopt in the already existing file like so:
stow --dotfiles --adopt --verbose zsh
What adopt will do is it will pull your already existing files in and put it's contents in in place of our contents. You have 2 options from this point.
Keeping Your Changes
If you want to keep your configuration instead of using the one provided in the repository you can just do a git commit. Highly recommend changing branches first. This can be done like so:
git checkout -b my-custom-config
git add --all
git commit -m "My custom configuration"
Using the repository version
If you instead want to use the version of the configuration provided from this repository that is easy as well. That can be accomplished with the following:
git restore zsh
In this instance that will revert all the changes to the zsh module (effectively erasing your changes and putting back the repository configuration) but the symlinks are still in place. Just replace zsh with the module that you want to restore back to the repository version.
Undeploying
If you want to undeploy the stowed files that can be done with the following:
stow --delete --verbose zsh
This command will unstow the zsh changes. The symlinks are removed and now you manually have to take care of the changes. If instead you want to redeploy you can run the following:
stow --restow --verbose zsh
This will unstow and then stow the files again. This is great to run if you for instance have moved files and you need to update the symlinks.
Useful Hints
Simulating Changes
If you are ever unsure of what is going to happen with a command you can always pass the --simulate flag. This combined with --verbose will show you exactly what would have changed without making any changes to any files on your system.