Skip to content

Instantly share code, notes, and snippets.

@kalebo
Last active August 25, 2017 23:25
Show Gist options
  • Save kalebo/a4854c441b084d144c32e50b99e6cd68 to your computer and use it in GitHub Desktop.
Save kalebo/a4854c441b084d144c32e50b99e6cd68 to your computer and use it in GitHub Desktop.
git clone --bare https://github.com/kalebo/dotfiles.git $HOME/.dotfiles
function gitdot {
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .dotfiles-backup
gitdot checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
gitdot checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles-backup/{}
fi;
gitdot checkout
gitdot config status.showUntrackedFiles no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment