Install Stow
brew install stowCreate a dotfiles folder to store all the dotfiles
mkdir ~/.dotfilesCreate an example file and see if they are symlinked.
cd ~/.dotfiles
mkdir rondomfir
cd rondomfir
touch random.txt
cd ..
stow rondomfirCheck if they are symlinked.
cd ~
ls -lah random.txt
They are symlinked!
Note: You get an error if you try to stow a file that is the same name as an existing file in the home directory
Example:
cd ~
touch random.txt
cd ~/.dotfiles
touch random.txt
stow .
# Doesn't workManage with Git
Now you can manage them with git without anything special.
After stowing some settings, it looks like:
tree -a -I ".git|.DS_Store"
Special Cases: VS Code on macOS
VS Code on macOS uses a non-standard path (~/Library/Application Support/Code/User/), which Stow cannot handle. Use manual symlinks instead:
# Move settings to dotfiles
mkdir -p ~/.dotfiles/vscode
mv ~/Library/Application\ Support/Code/User/settings.json ~/.dotfiles/vscode/
# Create symlink
ln -s ~/.dotfiles/vscode/settings.json ~/Library/Application\ Support/Code/User/settings.json