Skip to content

Instantly share code, notes, and snippets.

@dixiedream
Last active October 1, 2021 07:56
Show Gist options
  • Save dixiedream/8adbb2a5e526832757b6e8f03fff36c2 to your computer and use it in GitHub Desktop.
Save dixiedream/8adbb2a5e526832757b6e8f03fff36c2 to your computer and use it in GitHub Desktop.
Download Dotfiles
#!/bin/sh
set -e
# Download and setup my dotfiles, repo overriding possible just pass your repo as first argument
repo=${1:-https://github.com/dixiedream/dotfiles.git}
git clone --bare "$repo" "$HOME/.cfg"
function config {
/usr/bin/git --git-dir="$HOME/.cfg/" --work-tree="$HOME" $@
}
rm -rf .config
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment