Skip to content

Instantly share code, notes, and snippets.

@semoog
Created June 23, 2019 08:22
Show Gist options
  • Save semoog/0fe4880781faa9eb2676b2455a619f87 to your computer and use it in GitHub Desktop.
Save semoog/0fe4880781faa9eb2676b2455a619f87 to your computer and use it in GitHub Desktop.
Setup dotfiles on a new mac environment
git clone --bare https://github.com/semoog/dotfiles.git $HOME/.dotfiles
function dotfiles {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .dotfiles-backup
dotfiles checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dotfiles.";
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