Last active
May 9, 2017 17:20
-
-
Save coproduto/515f05bee9fb754df5c73ad79631d7b3 to your computer and use it in GitHub Desktop.
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
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