Skip to content

Instantly share code, notes, and snippets.

@itatabitovski
Last active May 19, 2024 19:30
Show Gist options
  • Save itatabitovski/0ff595d648012827d378c6ffe7be0fee to your computer and use it in GitHub Desktop.
Save itatabitovski/0ff595d648012827d378c6ffe7be0fee to your computer and use it in GitHub Desktop.
Bootstraping dotfiles on a fresh installation
#!/bin/bash
mkdir ~/src
git clone --bare https://github.com/itatabitovski/dotfiles.git $HOME/src/dotfiles
alias dotfiles="/usr/bin/git --git-dir=$HOME/src/dotfiles --work-tree=$HOME"
dotfiles checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
mkdir ~/.dotfiles-backup
dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles-backup/{}
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