Skip to content

Instantly share code, notes, and snippets.

@ljepson

ljepson/git.sh

Created Jul 4, 2012
Embed
What would you like to do?
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
You can’t perform that action at this time.