Skip to content

Instantly share code, notes, and snippets.

@fu5ha
Created July 25, 2017 02:14
Show Gist options
  • Save fu5ha/24fc565d287d0657cab68bbbb416816c to your computer and use it in GitHub Desktop.
Save fu5ha/24fc565d287d0657cab68bbbb416816c to your computer and use it in GitHub Desktop.
Checkout my config files into home directory
#!/bin/bash
curl -sSL https://get.oh-my.fish/ | fish
rm -rf $HOME/.config/omf
git clone --bare https://github.com/termhn/dotfiles $HOME/.dotfiles
function dotfiles {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .config-backup
dotfiles checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
fi;
dotfiles checkout
dotfiles config status.showUntrackedFiles no
echo "Checked out config.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment