Created
January 14, 2019 22:16
-
-
Save iAnatoly/70a54f8ee5938bf03aeb694582ec8f2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# based off https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/ | |
# | |
git clone --bare [email protected]: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