Skip to content

Instantly share code, notes, and snippets.

@edi33416
Created October 5, 2017 15:30
Show Gist options
  • Save edi33416/e3ea7bed3131223eb0834b9bb6b4f8b7 to your computer and use it in GitHub Desktop.
Save edi33416/e3ea7bed3131223eb0834b9bb6b4f8b7 to your computer and use it in GitHub Desktop.
My dotfiles install script
git clone --bare https://github.com/edi33416/dotfiles.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME "$@"
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
fi;
config checkout
config config status.showUntrackedFiles no
# Credits to https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
# Usage: curl -Lks http://bit.do/cfg-install | /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment