Skip to content

Instantly share code, notes, and snippets.

@cvanelteren
Created July 20, 2024 17:51
Show Gist options
  • Save cvanelteren/8f103823bef0c6c3b31243f6b2adedff to your computer and use it in GitHub Desktop.
Save cvanelteren/8f103823bef0c6c3b31243f6b2adedff to your computer and use it in GitHub Desktop.
clone dots
#!/usr/bin/env bashgit clone --bare [email protected]:cvanelteren/dots.git $HOME/.dotfiles# define config alias locally since the dotfiles
# aren't installed on the system yet
function config {
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}# create a directory to backup existing dotfiles to
mkdir -p .dotfiles-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out dotfiles from [email protected]:cvanelteren/dotfiles.git";
else
echo "Moving existing dotfiles to ~/.dotfiles-backup";
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles-backup/{}
fi# checkout dotfiles from repo
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