Created
July 4, 2012 06:11
-
-
Save ljepson/3045666 to your computer and use it in GitHub Desktop.
Create links for all files stored in git to your local dot files. You can now keep backups on git with ease.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p $HOME/git/dotfiles/vim; | |
files=("bash_profile bashrc inputrc screenrc vim vimrc zshrc"); | |
for file in $files; do | |
if [[ -h $HOME/.$file ]]; then | |
unlink $HOME/"."$file; | |
elif [[ -e $HOME/.$file ]]; then | |
mv $HOME/"."$file $HOME/"."$file"."$(date +%m"."%d"."%Y) | |
fi; | |
ln -s $HOME/git/dotfiles/$file $HOME/"."$file; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment