Last active
February 6, 2025 15:58
-
-
Save lytvynda/e246473074180e7ea1fb6e37e71fe3b2 to your computer and use it in GitHub Desktop.
Clone bare repository with dotfiles and setup dotfiles
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
set -e | |
git clone --bare https://github.com/lytvynda/dotfiles.git $HOME/.cfg | |
function dotfiles { | |
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ | |
} | |
dotfiles checkout > /dev/null 2>&1 | |
if [ $? = 0 ]; then | |
echo "Checked out dotfiles"; | |
else | |
echo "Backing up pre-existing dot files into .config-backup"; | |
mkdir -p .config-backup | |
dotfiles checkout 2>&1 | egrep "\s+\." | awk '{print $1}' | xargs -I{} sh -c 'mv "{}" ".config-backup/$(basename "{}")"' | |
fi; | |
dotfiles checkout | |
dotfiles config status.showUntrackedFiles no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment