Created
July 20, 2024 17:51
-
-
Save cvanelteren/8f103823bef0c6c3b31243f6b2adedff to your computer and use it in GitHub Desktop.
clone dots
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
#!/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