Skip to content

Instantly share code, notes, and snippets.

@jechasteen
Last active January 2, 2020 11:46
Show Gist options
  • Save jechasteen/d7f49855510d0fb13e7689b6f29d695e to your computer and use it in GitHub Desktop.
Save jechasteen/d7f49855510d0fb13e7689b6f29d695e to your computer and use it in GitHub Desktop.
A quick script to install my dot files
#!/usr/bin/env bash
# Credit to the tutorial found at
# https://www.atlassian.com/git/tutorials/dotfiles
config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
git clone --bare https://github.com/jechasteen/dotfiles.git $HOME/.cfg && $config checkout
if [[ "$?" = 0 ]]; then
echo "Checked out dot files repo..."
else
echo "Backing up pre-existing dot files"
mkdir -p .config-backup
$config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
fi
$config checkout
$config config --local status.showUntrackedFiles no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment