Skip to content

Instantly share code, notes, and snippets.

@redraw
Last active March 17, 2021 00:48
Show Gist options
  • Select an option

  • Save redraw/e0f11412c2983364e27b1a79299307c2 to your computer and use it in GitHub Desktop.

Select an option

Save redraw/e0f11412c2983364e27b1a79299307c2 to your computer and use it in GitHub Desktop.
restore dotfiles script
#!/bin/bash
# clone repo
git clone --bare git@github.com:redraw/dotfiles.git $HOME/.dotfiles
dotfiles () { git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME "$@"; }
# backup
for file in $(dotfiles ls-tree --name-only HEAD); do
mv -vf $file $file.bak 2>/dev/null
done
# checkout
dotfiles checkout
dotfiles config status.showUntrackedFiles no
echo -e "\e[1m setup running .bin/setup.sh \e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment