Skip to content

Instantly share code, notes, and snippets.

@ljepson
Created July 4, 2012 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljepson/3045666 to your computer and use it in GitHub Desktop.
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.
#!/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