Created
July 30, 2021 15:22
-
-
Save NickCrew/1f2097bab027e0747483649a4d6c5f70 to your computer and use it in GitHub Desktop.
Install dots
This file contains hidden or 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 bash | |
set -e | |
function cfg { | |
git --work-tree=$HOME --git-dir=$HOME/.cfg $@ | |
} | |
git clone --bare https://github.com/NickCrew/dotfiles.git $HOME/.cfg | |
mkdir -p .config-backup | |
cfg checkout | |
if [ $? = 0 ]; then | |
echo "Checked out config. Branch: ${branch}"; | |
else | |
echo "Backing up pre-existing dot files."; | |
cfg checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{} | |
fi; | |
cfg checkout | |
cfg config status.showUntrackedFiles no | |
if [ -f ~/.config/cfg/bootstrap ]; then | |
ln -s ~/.config/cfg/bootstrap ~/bin/bootstrap-cfg | |
fi | |
echo "'cfg' command is now available. Accepts all standard git arguments." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment