Skip to content

Instantly share code, notes, and snippets.

@coproduto
Last active May 9, 2017 17:20
Show Gist options
  • Save coproduto/515f05bee9fb754df5c73ad79631d7b3 to your computer and use it in GitHub Desktop.
Save coproduto/515f05bee9fb754df5c73ad79631d7b3 to your computer and use it in GitHub Desktop.
if [ -d $HOME/.dotfiles ]; then
printf "Dotfiles directory already exists at $HOME/.dotfiles.\n\n"
printf "If you are sure you wish to restore dotfiles, delete the existing directory.\n\n"
exit 1
fi
git clone --bare https://github.com/pcstl/dotfiles.git $HOME/.dotfiles
unalias dotfile 2> /dev/null
dotfile() {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .config-backup
while
dotfile checkout 2> /dev/null
[ $? != 0 ];
do
echo "Backing up pre-existing dotfiles."
dotfile checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
done;
echo "Checked out config".
dotfile config status.showUntrackedFiles no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment