Skip to content

Instantly share code, notes, and snippets.

@iAnatoly
Created January 14, 2019 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iAnatoly/70a54f8ee5938bf03aeb694582ec8f2f to your computer and use it in GitHub Desktop.
Save iAnatoly/70a54f8ee5938bf03aeb694582ec8f2f to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# based off https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
#
git clone --bare git@github.com:iAnatoly/homedot.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
BACKUP=".config-backup"
[ -d $BACKUP ] || mkdir $BACKUP
echo "Backing up pre-existing dot files into $BACKUP:"
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} $BACKUP/{}
echo "Done."
fi;
config checkout
config config status.showUntrackedFiles no
config status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment