Skip to content

Instantly share code, notes, and snippets.

@jmcker
Last active November 18, 2018 05:07
Show Gist options
  • Save jmcker/f9ed4121dad42c3203b103c0d0f1369b to your computer and use it in GitHub Desktop.
Save jmcker/f9ed4121dad42c3203b103c0d0f1369b to your computer and use it in GitHub Desktop.
#!/bin/bash/
git clone --bare https://github.com/jmcker/.cfg.git $HOME/.cfg
function cfg {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .cfg-backup
cfg checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up existing dot files.";
cfg checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .cfg-backup/{}
fi;
cfg checkout
cfg config status.showUntrackedFiles no
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment