Skip to content

Instantly share code, notes, and snippets.

@lidopaglia
Created May 23, 2020 15:27
Show Gist options
  • Save lidopaglia/32eff2fc2d5021038cdb02ebafd043d5 to your computer and use it in GitHub Desktop.
Save lidopaglia/32eff2fc2d5021038cdb02ebafd043d5 to your computer and use it in GitHub Desktop.
Install dotfiles on an existing system
!#/bin/sh
git clone --bare [email protected]:lidopaglia/dotfiles.git $HOME/.dotfiles
function dot {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .dotfiles-backup
dot checkout
if [ $? = 0 ]; then
echo "Checked out dotfiles.";
else
echo "Backing up pre-existing files.";
dot checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles-backup/{}
fi;
dot checkout
dot config status.showUntrackedFiles no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment